Skip to content

Instantly share code, notes, and snippets.

View juanmaguitar's full-sized avatar

JuanMa juanmaguitar

View GitHub Profile

English (programming) symbol names

  • [] brackets
  • () parentheses, round brackets
  • {} curly braces
  • <> chevrons, angle brackets
  • ; semi-colon
  • : colon
  • . period, dot
  • , comma
@juanmaguitar
juanmaguitar / debug-hooks.php
Created March 22, 2016 16:40
debug hooks wordpress
<?php
/* From => http://www.rarst.net/wordpress/debug-wordpress-hooks/ */
function dump_hook( $tag, $hook ) {
ksort($hook);
echo "<pre>>>>>>\t$tag<br>";
foreach( $hook as $priority => $functions ) {
@juanmaguitar
juanmaguitar / add-subdomain.sh
Last active July 19, 2024 18:41
Local Wordpress Multisite Trellis Installation
#!/usr/bin/env bash
# Config Variables
args=("$@")
SUBDOMAIN_KEY=${args[0]}
source ../site/.env
sudo sh -c "echo '192.168.50.5 $SUBDOMAIN_KEY.$DOMAIN_CURRENT_SITE' >> /etc/hosts"
@juanmaguitar
juanmaguitar / invite-all.js
Created April 13, 2016 15:43
facebook "invitar a amigos"
var buttons = document.querySelectorAll(".fbProfileBrowserListItem .uiButton")
for (var i=0; i<buttons.length; i++) {
$(buttons[i]).click();
}
@juanmaguitar
juanmaguitar / index.html
Created June 4, 2016 09:34
Angular Bootstrap jQuery boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Document</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
@juanmaguitar
juanmaguitar / functions.php
Last active October 6, 2019 09:34
Disable endpoints Wordpress API
/* ---- endpoints API ---- */
function disableAllEndpoints( $endpoints ){
foreach ($endpoints as $clave => $valor) {
unset( $endpoints[$clave] );
}
return $endpoints;
}
@juanmaguitar
juanmaguitar / fibonacciNth.js
Last active September 12, 2016 11:07
JS:fibonacciNth
function fibonacciNth ( position ) {
switch (position) {
case 0:
return -1;
case 1:
return 0;
case 2:
return 1;
default:
return fibonacciNth(position-1)+fibonacciNth(position-2);
@juanmaguitar
juanmaguitar / gist:f596f037234efec39eb1c3a10ce41232
Created September 12, 2016 11:28
BASH:CURL post github w/ data
curl -v -u USERNAME -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"SublimeText 2/3 Gist plugin\"}"
@juanmaguitar
juanmaguitar / guidMaker.js
Last active September 27, 2016 15:00
guidMaker using iterators (infinite)
function guidMaker(){
function generator() {
const S4 = () => (((1+Math.random())*0x10000)|0).toString(16).substring(1);
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
const done = false;
let generated = 0;
@juanmaguitar
juanmaguitar / symbols-es2015.md
Last active September 28, 2016 10:24
Symbols (ES2015 Notes)

Symbols (ES2015 Notes)

The symbol is a new primitive type, a unique token that is guaranteed never to clash with another symbol → a kind of UUID (Universally Unique Identifier)

ES2015 symbols are values, but they’re not strings. They’re not objects. They’re something new: a seventh type of value.

The primary reason for the introduction of symbols seems to have been to facilitate adding new functionality to the language without breaking existing code (hidden and unique properties)

Con los symbol podemos añadir propiedades ocultas y unicas a los objetos que nos permiten extender objetos facilmente.