Skip to content

Instantly share code, notes, and snippets.

View AndrewIngram's full-sized avatar
🦊
Being foxy

Andy Ingram AndrewIngram

🦊
Being foxy
View GitHub Profile
@AndrewIngram
AndrewIngram / gist:7560897
Created November 20, 2013 10:22
Pokéhash
>>> import requests
>>> import random
>>> random.seed(<YOUR COMMIT HASH>)
>>> poke_id = random.choice(range(1,719))
>>> data = requests.get('http://pokeapi.co/api/v1/pokemon/' + str(poke_id) + '/')
>>> data.json()['name']
<div data-ofs-component="responsive">
<div class="full" data-media="(min-width: 769px)">
<span data-ofs-component="picture" class="image image-panorama_a">
<!-- normal picturefill markup -->
</span>
</div>
<div class="tablet" data-media="(min-width: 481px) and (max-width : 768px)">
<span data-ofs-component="picture" class="image image-tablet_a">
<!-- normal picturefill markup -->
</span>
@AndrewIngram
AndrewIngram / gist:8285680
Last active January 2, 2016 09:49
Ragadjust for Python (http://24ways.org/2013/run-ragged/), untested
ENGLISH_PREPOSITIONS = (
'aboard',
'about',
'above',
'across',
'after',
'against',
'along',
'amid',
'among',
var Datepicker = React.createClass({
render: function() {
return this.transferPropsTo(<input />);
}
});
$(document).ready(function() {
$('.datepicker').each(function(index, element) {
React.renderComponent(
<Datepicker />,
@AndrewIngram
AndrewIngram / gist:52519272446c66e7fbf2
Created June 29, 2014 12:55
Website Pre-launch Checklist
  • Make sure it does something useful.
(function() {
var options = {};
var EntryPoint = require('{{ JS_ENTRY_POINT }}');
var entry = new EntryPoint(options);
$(function() {
entry.render(document);
});
})();
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
library: './static/js/library'
},
output: {
path: 'mediacat/static/mediacat/',
@AndrewIngram
AndrewIngram / gist:0ee71fa20b577b869eb1
Created August 18, 2014 16:00
Immutable JS Cursors
var Immutable = require('immutable');
var data = Immutable.fromJS({ a: { b: { c: 1 } } });
data.toJS();
// { a: { b: { c: 1 } } }
var cursor = data.cursor(['a'], function(newData) { data = newData; });
cursor.set('d', 2);
var Mousetrap = require('mousetrap');
var Immutable = require('immutable');
class Keyboard {
constructor() {
this.keyStack = Immutable.fromJS([[]]);
}
push() {
this.keyStack = this.keyStack.push(Immutable.fromJS([]));
var React = require('react');
var KeyboardMixin = {
propTypes: {
keyboard: React.PropTypes.object
},
contextTypes: {
keyboard: React.PropTypes.object
},