Skip to content

Instantly share code, notes, and snippets.

View jackfranklin's full-sized avatar

Jack Franklin jackfranklin

View GitHub Profile
const User = props => <p>This would render a user</p>
class Users extends React.Component {
// has this.state.users which is an array from an API
// not gonna bother writing the code to fetch that...
render() {
return (
<div>
<h2>The users</h2>
<ul>

Confusing Components

Do I need all four parts?

  • Custom Elements
  • Shadow DOM
  • HTML Imports
  • HTML Templates

I'm confused as to which bits I need supported. Do I need all of them to blindy create and use other components?

case 'TOGGLE_TODO':
const todos = state.todos.map((todo) => {
if (todo.id === action.id) {
todo.done = !todo.done;
}
return todo;
});
return { todos };
@jackfranklin
jackfranklin / omg.js
Created October 21, 2015 13:38
Deep destructuring and renaming in ES6
function foo({ text, user: { screen_name: screenName }}) {
console.log('text', text);
console.log('name', screenName);
}
foo({
text: 'hello world',
user: { screen_name: 'Jack' },
});

Keybase proof

I hereby claim:

  • I am jackfranklin on github.
  • I am jackfranklin (https://keybase.io/jackfranklin) on keybase.
  • I have a public key whose fingerprint is 19A8 CC89 2230 3100 8B5F 7343 0FA7 7A5E 4B09 EA2B

To claim this, I am signing this object:

@jackfranklin
jackfranklin / gist:d68da70ed43203c2eb4a
Created October 3, 2014 15:54
playing with generators
var Q = require('Q');
var fs = require('fs');
var generator = Q.async(function* () {
yield 10
console.log('yielded 10');
yield 20
console.log('yielded 20');
yield 30
def double(x)
x * 2
end
p [1,2,3].map(&method(:double))
# [2, 4, 6]
class Hodor
def method_missing(sym)
'Hodor'
end
end
puts Hodor.new.hello
puts Hodor.new.blahblah
Team Bibs
- Jack
- Grant "The Rock" Heywood
- Kyam
- Matt P
- Dave "Stepovers" Kelly
- Dan "Stripper" Dineen
- Darren
Team STINKYFACES
@jackfranklin
jackfranklin / gist:10560583
Created April 12, 2014 22:44
ES6 Arrow Functions FTW.
module.exports = function(app) {
var lookup = {
'NOT_STARTED': 'not started',
'STARTED': 'started',
'BLOCKED': 'blocked'
};
app.filter('prettyState', () => (input) => lookup[input]);
app.filter('prettyState', function() {
return function(input) {