Skip to content

Instantly share code, notes, and snippets.

View adjohu's full-sized avatar
🎶
Writing code

Adam Hutchinson adjohu

🎶
Writing code
View GitHub Profile
import {random} from 'lodash';
// import {run} from 'modules/engine';
// run();
const width = 320;
const height = 200;
const maxHeat = 255;
const size = width * height;
@adjohu
adjohu / testThing.js
Created March 30, 2016 14:44
local styles transition group
import React, {PropTypes} from 'react';
import TransitionGroup from 'react-addons-css-transition-group';
import styles from './testThing.scss';
function randomItem() {
return {
name: Array(Math.floor(Math.random() * 15)).join('a'),
key: Math.random()
}
}
<snippet>
<content><![CDATA[
import React, {PropTypes} from 'react';
//import styles from './${TM_FILENAME/(.+).js/\1/g}.scss';
class ${TM_FILENAME/(.+).js/\u\1/g} extends React.Component {
static defaultProps = {
$4
};
@adjohu
adjohu / index.js
Created March 20, 2016 21:19
react-motion-parallax
export {default as Parallax} from './parallax.js';
export {default as default} from './parallax.js';
export {Layer as Layer} from './layer.js';
// This is a modified version of vps.js for use with cloudserver presales.
// TODO: refactor configurator to be a class which is extended by VPS and Cloud.
(function ($) {
'use strict';
var capitalize = function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
// Model
import React, {PropTypes} from 'react';
import TransitionGroup from '../transitionGroup';
class StaggeredTransitionGroup extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
}
.cc_banner-wrapper {
z-index: 9001;
position: relative
}
.cc_container .cc_btn {
cursor: pointer;
text-align: center;
font-size: 0.6em;
transition: font-size 200ms;
line-height: 1em
@adjohu
adjohu / holdListener.js
Last active August 29, 2015 14:22
react hold listener wrapper usage <HoldListener onHold={this.handleHold}><Card /></HoldListener>
import React from 'react'
class HoldListener extends React.Component {
constructor() {
super();
}
handleMouseDown() {
this.timeout = setTimeout(this.props.onHold, this.props.threshold);
}
sdfdfdsff
var wrappedResourceMethods = [
'get', 'query'
];
var wrappedResource = function (resource) {
_.each(wrappedResourceMethods, function (method) {
if (_.has(resource, method)) {
var originalMethod = resource[method];
resource[method] = function () {
var result = originalMethod.apply(this, arguments);