Skip to content

Instantly share code, notes, and snippets.

View jjgonecrypto's full-sized avatar
🔗
Eth wrangling.

j-j.eth jjgonecrypto

🔗
Eth wrangling.
View GitHub Profile
@jjgonecrypto
jjgonecrypto / nodejs6-proxy.md
Last active February 16, 2017 20:55
Create dynamic objects in a nodejs6 REPL with Proxy

#Create dynamic objects in a nodejs6 REPL with Proxy

Nodejs 6.x comes with ES6 Proxy support baked in. Just like Ruby's method-missing (aka ghost methods), you can intercept getters and setters on an object and, like ActiveRecord in Rails, write rich APIs that can take any method or property name you like.

They are particularly fun in a REPL, where you might want to handle undefined variables.

For example, say we started a nodejs REPL via:

@jjgonecrypto
jjgonecrypto / App.js
Last active October 6, 2016 16:08
Navigator in react-native
import Start from './Start'
import NextPage from './NextPage'
const Views = { Start, NextPage }
<Navigator
initialRoute={{ view: 'Start' }}
renderScene={(route, navigator) => {
const SceneComponent = Views[route.view];
return <SceneComponent {...route.props} navigator={navigator} />;
@jjgonecrypto
jjgonecrypto / echoline.sh
Created March 11, 2016 22:23
Echo 5 lines before and after line in a file
#Usage echoline LINE_NUMBER FILE
function echoline() { sed -n "$(($1 - 5)),$(($1 + 5))p" $2; }
@jjgonecrypto
jjgonecrypto / gist:3987615
Created October 31, 2012 15:20
git remove local merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
@jjgonecrypto
jjgonecrypto / gist:3987610
Created October 31, 2012 15:19
delete used remote branches
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$' | xargs -I% git push origin :%
@jjgonecrypto
jjgonecrypto / example.coffee
Created August 24, 2012 15:16
little coffeescript class quiz
class Person
info: {}
setName: (name) -> @info.name = name
justin = new Person()
justin.setName "justin"
paul = new Person()
@jjgonecrypto
jjgonecrypto / gist:3195313
Created July 28, 2012 23:45
mimic jquery selectors from unattached html (as text) in webkit
doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html')
doc.documentElement.innerHTML = "<div><p class='first'>...</p></div>"
nodeList = doc.querySelectorAll(".first")
@jjgonecrypto
jjgonecrypto / main.coffee
Created June 18, 2012 18:04
require 2.0 shims
require.config
baseUrl: '/static/coffee/app'
paths:
text: '/static/js/require.text'
underscore: '/static/js/underscore-min'
backbone: '/static/js/backbone-min'
backboneTP: '/static/js/backbone-tastypie'
shim:
underscore:
exports: '_'
Feature: Present clearly
As a presenter
I'd like to ensure my content is clear and concise
So that my audience understand the value of Cucumber
Scenario: Ensure audience can see the presentation
Given I start the presentation off
Then the audience should be able to see the initial slide
And the slide should have the content "green like a cuke!"
this.browser.clickLink(link, function(e, b, s) {
b.onconfirm(function(q){ return true; });
callback(e,b,s);
});