Skip to content

Instantly share code, notes, and snippets.

Hadrian thelambdaparty

Block or report user

Report or block thelambdaparty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functionalWorld.js
const getCurrentUser = api.v2 `/users/current`
const App = (props) => (
<div>
<p>Hello {props.name || 'World'}</p>
<button onClick={event('loadUser')}>
Load User
</button>
</div>
)
View index.js
let React = require('react')
let ReactDOM = require('react-dom')
let d = React.DOM
function Ajax () {}
function State () {}
let interface = {
handler () {},
ajax () {},
@thelambdaparty
thelambdaparty / index.js
Last active Apr 5, 2016
requirebin sketch
View index.js
let $ = require('jquery')
let f = require('flightjs')
let h = require('hyperscript-helpers')(require('hyperscript'))
let _ = require('lodash')
let Immutable = require('seamless-immutable')
let id = () => _.uniqueId('_')
function render () {
$('head')
@thelambdaparty
thelambdaparty / index.js
Last active Apr 1, 2016
requirebin sketch
View index.js
console.clear()
let $ = require('jquery')
let f = require('flightjs')
let h = require('hyperscript-helpers')(require('hyperscript'))
let _ = require('lodash')
let id = () => _.uniqueId('_')
function render () {
// -------------------------------------------------------------
@thelambdaparty
thelambdaparty / StaticClass.js
Created Feb 19, 2016
Make methods of class also available statically
View StaticClass.js
function Static (Class)
{
Object.getOwnPropertyNames (Class.prototype)
.filter (n => n != "constructor")
.forEach (method =>
Class[ method ] = Class.prototype[ method ])
return Class
}
View functionalTesting.js
let isNotEmpty = value => value.length > 0
let isString = value => typeof value == "string"
let startsWith = match => value => (new RegExp(`^${match}`)).test(value)
function checkThat (...checkFunctions)
{
return value =>
checkFunctions.reduce((result, checkFunction) =>
result ? checkFunction(value) : result, true)
}
View LearnJavaScript.txt
Books:
- Speaking JavaScript
|- http://speakingjs.com/es5/
- JavaScript The Good Parts
|- http://shop.oreilly.com/product/9780596517748.do
- Exploring ES6
|- http://exploringjs.com/es6/
Docs:
- JavaScript
View Single State & React.jsx
// Object.deepExtend : https://gist.github.com/thelambdaparty/80679d67ae1fc0326778
// Live example: https://codepen.io/hadrian/pen/ojOJYB?editors=001
// -------------------------------------------------------------
let initialState =
{
info :
{
name : "Barney"
View ObjectDeepExtend.js
Object.isObject = function (value)
{
return (value
&& value.constructor
&& value.constructor === Object)
}
Object.deepExtendMultable = function deepExtendMultable (destination, source)
{
for (let property in source)
You can’t perform that action at this time.