Skip to content

Instantly share code, notes, and snippets.

View robertoentringer's full-sized avatar
🖥️
Working from home

Roberto Entringer robertoentringer

🖥️
Working from home
View GitHub Profile
@retronav
retronav / esbuild-dev.ts
Created November 12, 2020 14:25
Watch and build code with esbuild
import { startService } from "esbuild";
import { watch } from "chokidar";
const noop = () => {};
/**
* Function to update lines when something happens
* @param input The text you want to print
* @param isBuiltInput Whether you are printing `Built in x ms` or not
*/
@pbrocks
pbrocks / install-phpcs-with-homebrew.md
Last active June 3, 2024 14:27
Install phpcs with Homebrew

Install phpcs with Homebrew

To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:

In a terminal window on your Mac, start by updating your Homebrew.

brew doctor

Then install the Code Sniffer:

@sohamkamani
sohamkamani / rsa.js
Last active July 4, 2024 13:04
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@MelMacaluso
MelMacaluso / expose_ACF_fields_to_REST.php
Created June 4, 2019 22:54
Automatically expose all the ACF fields to the Wordpress REST API in Pages and in your custom post types.
<?php
function create_ACF_meta_in_REST() {
$postypes_to_exclude = ['acf-field-group','acf-field'];
$extra_postypes_to_include = ["page"];
$post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude);
array_push($post_types, $extra_postypes_to_include);
foreach ($post_types as $post_type) {
register_rest_field( $post_type, 'ACF', [
@robertoentringer
robertoentringer / .eslintrc-chrome-ext.js
Last active June 2, 2019 14:28
My eslint config to working with prettier.
module.exports = {
env: {
commonjs: true,
browser: true,
es6: true
},
extends: ["eslint:recommended", "plugin:prettier/recommended"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
@robertoentringer
robertoentringer / README.md
Last active May 12, 2019 00:16
Bash script to clear out the history of a git/github repository.

Call directly from your terminal

$ bash <(curl -s https://gist.githubusercontent.com/robertoentringer/c9e327479f012bafeaeaaf48d3966aaf/raw)
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
@ZeroQI
ZeroQI / Synology recover.txt
Last active May 6, 2024 07:53
Synology Raid repair
Backup raid config
------------------
DiskStation> cd /etc/space
DiskStation> ls -lh
DiskStation> cat space_history_20130806_135258.xml
Corrupted system partition
--------------------------
DiskStation> cat /proc/mdstat
md0 : active raid1 sda1[0]
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.