Skip to content

Instantly share code, notes, and snippets.

View fjaguero's full-sized avatar
🏠
Working from home

Fernando Agüero fjaguero

🏠
Working from home
View GitHub Profile
g.php:
<html>
<head>
<script type="text/javascript">
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
@albertorestifo
albertorestifo / propdiff.js
Created April 12, 2017 15:55
Logs the diff between current and previous props on a react element
componentDidUpdate(prevProps) {
console.log('Rrow update diff:');
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined) return true;
if (prevProps[key] !== val) {
console.log(`${key}
- ${JSON.stringify(val)}
# Download every episode of How It's Made from Youtube
# Needs: youtube-dl
urlencode() {
python -c "import sys, urllib; print urllib.quote_plus(sys.stdin.read())"
}
dl(){
q=`echo How its made $2 $3 $4 | urlencode`
youtube-dl --max-downloads=1 -o "HowItsMade_${1}_%(title)s_%(format)s.%(ext)s" "https://www.youtube.com/results?search_query=$q"
@zackify
zackify / gist:acf19f6ca0f8be13fb90
Last active January 14, 2020 15:06
Visually see react elements
setInterval(function() {
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]'))
.forEach(function(element) {
element.style.background = 'rgba(255,0,0,0.1)';
})
}, 500)
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

# METEOR CORE:
Anywhere: Meteor.isClient
Anywhere: Meteor.isServer
Anywhere: Meteor.startup(func)
Anywhere: Meteor.absoluteUrl([path], [options])
Anywhere: Meteor.settings
Anywhere: Meteor.release
@gianpaj
gianpaj / iterm-automation.sh
Created May 14, 2014 23:30
Automate opening of new tabs in iTerm/Terminal and start command or daemon
#!/bin/bash
echo
echo "Opening project services in a new iTerm window"
osascript <<EOD
launch "iTerm"
tell application "iTerm"
activate
set myterm to (make new terminal)
@joannecheng
joannecheng / index.html
Last active May 19, 2016 11:35
FutureJS Live Coding example
<!DOCTYPE html>
<meta charset="utf-8">
<style>
circle.jupiter {
fill: rgb(200, 80, 40);
}
circle.saturn {
fill: rgb(230, 180, 40);
}
circle.neptune {
@slashdotdash
slashdotdash / index.html
Last active August 25, 2017 01:30
React + D3
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React + D3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.8.0/react.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.8.0/JSXTransformer.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.13/d3.js"></script>
@b1rdex
b1rdex / main.js
Last active December 27, 2015 23:49
node-webkit cut/copy/paste context menu example
// script moved to http://github.com/b1rdex/nw-contextmenu