Skip to content

Instantly share code, notes, and snippets.

View dmsanchez86's full-sized avatar
😎
Working from home

Daniel Mauricio Sánchez Ávila dmsanchez86

😎
Working from home
View GitHub Profile
@siddharthkp
siddharthkp / reactivconf-2017-proposal.md
Last active February 25, 2024 10:06
Building applications for the next billion users
class Random {
async getRandom () {
return await getRandomWithPromise();
}
}
(async function () {
var random = new Random();
console.log(`Your random number is ${await random.getRandom()}!`)
})();
@miya0001
miya0001 / cors-for-the-wordpress-rest-api.php
Last active January 29, 2025 02:47
CORS for the WordPress REST API
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );
.type.storage,.type.storage.declaration, .storage.class.modifier {
font-family: 'flottflott';
font-size: 1.7em;
}
.type.storage.arrow.function {
font-family: 'Fira Code'
}
.decorator.name, .decorator.punctuation:not(.block), .import.keyword {
@veganista
veganista / file.liquid
Created April 20, 2016 10:56
Debugging Objects in Shopify Templates
<script>console.log({{ product | json }});</script>
@kutyel
kutyel / reduce.js
Last active August 15, 2017 21:47
reduce() vs Universe
// reduce() awesomeness
const a = [1, 2, 3, 4, 5, 5, 3]
const b = [{ key: 1, value: 'a' }, { key: 2, value: 'b' }]
const c = [Promise.resolve(), Promise.resolve(), Promise.resolve()]
const d = ['a', 'a', 'a', 'a', 'a']
// Max
a.reduce((x, y) => x > y ? x : y) // > 5
// Min
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@paulirish
paulirish / rAF.js
Last active March 5, 2025 08:53
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];