Skip to content

Instantly share code, notes, and snippets.

@dmytro-kerest
dmytro-kerest / ACFSyncFieldGroups.php
Created September 29, 2023 08:47 — forked from hirasso/ACFSyncFieldGroups.php
A WordPress Plugin that allows to sync ACF field groups via WP CLI
<?php
/*
* Plugin Name: ACFSyncFieldGroups
* Plugin URI: https://gist.github.com/hirasso/c48c04def92f839f6264349a1be773b3
* Description: Allows to sync ACF field groups via WP CLI
* Version: 0.0.1
* Author: Rasso Hilber
* Author URI: https://rassohilber.com/
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@dmytro-kerest
dmytro-kerest / states.json
Created October 13, 2020 10:52 — forked from Charles-WC/states.json
States
[
{
"name": "Alabama",
"alpha": "AL"
},
{
"name": "Alaska",
"alpha": "AK"
},
{
@dmytro-kerest
dmytro-kerest / git-reset-author.sh
Created April 22, 2020 06:13 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
import React, {useState} from 'react';
import { useLocation } from 'react-router-dom';
import Avatar from '@material-ui/core/Avatar';
import Button from '@material-ui/core/Button';
import CssBaseline from '@material-ui/core/CssBaseline';
import TextField from '@material-ui/core/TextField';
import Link from '@material-ui/core/Link';
import Grid from '@material-ui/core/Grid';
import Box from '@material-ui/core/Box';
import VpnKeyIcon from '@material-ui/icons/VpnKey';
import React, {useState} from 'react';
import Avatar from '@material-ui/core/Avatar';
import Button from '@material-ui/core/Button';
import CssBaseline from '@material-ui/core/CssBaseline';
import TextField from '@material-ui/core/TextField';
import Link from '@material-ui/core/Link';
import Grid from '@material-ui/core/Grid';
import Box from '@material-ui/core/Box';
import LockOutlinedIcon from '@material-ui/icons/LockOutlined';
import Typography from '@material-ui/core/Typography';
import { Request, Response } from "express";
import XeroService from '../services/XeroService';
import LocateServiceFactory from "../services/LocateServiceFactory";
export default class XeroLocateController {
static createProject = async (req: Request, res: Response) => {
const { name, env } = req.query;
const locateService = await LocateServiceFactory.create(env);
try {
import { Request, Response, NextFunction } from "express";
export const sse = async (req: Request, res: Response, next: NextFunction) => {
if (req.headers.accept && req.headers.accept === 'text/event-stream') {
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
});
res.locals = {
@dmytro-kerest
dmytro-kerest / jwtMiddleware.ts
Created March 10, 2020 12:10
jwt middleware
import { Request, Response, NextFunction } from "express";
import * as jwt from "jsonwebtoken";
import config from "../config/config";
export const checkJwt = (req: Request, res: Response, next: NextFunction) => {
const token = <string>req.headers["authorization"].match(/^Bearer (.*)$/)[1];
let jwtPayload;
try {
jwtPayload = <any>jwt.verify(token, config.jwtSecret);
@dmytro-kerest
dmytro-kerest / XeroService.ts
Created March 10, 2020 12:04
Simple backend servce to create project in Xero API
import Config from '../config/config';
import { AccountingAPIClient as XeroClient } from 'xero-node';
import { XeroClientConfiguration } from 'xero-node/lib/internals/BaseAPIClient';
export default class XeroService {
static createProject = async (name: string) => {
const { apiConfig, trackingProjectCategoryName } = Config.xero;
try {
let xeroClient = new XeroClient(apiConfig as XeroClientConfiguration);