Skip to content

Instantly share code, notes, and snippets.

View generateBase32Key.js
// Adapted from Python's implementation of randrange.
// https://github.com/python/cpython/blob/master/Lib/random.py
const crypto = require('crypto');
const bases = require('bases');
const START = 33554432; // '100000'
const END = 1073741824; // 'ZZZZZZ'
function getrandbits(k) {
@dstaley
dstaley / elevation.js
Last active Jan 3, 2018
Material Design elevations powered by emotion.
View elevation.js
// Adapted from https://github.com/material-components/material-components-web
import { css } from "emotion";
import tinycolor from "tinycolor2";
const umbraMap = {
"0": "0px 0px 0px 0px",
"1": "0px 2px 1px -1px",
"2": "0px 3px 1px -2px",
"3": "0px 3px 3px -2px",
"4": "0px 2px 4px -1px",
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
items: [{'name': 'Bob'}]
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
options: [
{
"display_name": "Color",
"option_id": 1128,
"sort_order": 0,
"values": [
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
images: [
{'id': 0, 'name':'first', 'src': 'https://i.imgur.com/uQbAV8a.gif'},
{'id': 1, 'name':'second', 'src': 'http://replygif.net/i/715.gif'},
{'id': 2, 'name':'third', 'src': 'http://25.media.tumblr.com/tumblr_lovjrlNfbB1qaxm3co6_500.gif'}
]
});
View index.js
let ThemeComponent = React.createClass({
getInitialState() {
return {
'theme': 'Day',
};
},
getStyle(element) {
return [baseStyles[element], themeStyles[this.state.theme][element]];
},
render() {
View entries.json
[
{
"id": 1037596207,
"feed_id": 1915,
"title": "Apple Music reportedly approaches half as many paid subscribers as Spotify",
"author": "Dante D'Orazio",
"content": "...",
"summary": "...",
"url": "http://www.theverge.com/2016/1/10/10745630/apple-music-total-paid-subscribers-vs-spotify",
"published": "2016-01-10T18:35:37.000000Z",
View bootstrap-dropdown.js
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=3356eb28a4f746ca1528)
* Config saved to config.json and https://gist.github.com/3356eb28a4f746ca1528
*/
@dstaley
dstaley / SassMeister-input.scss
Created Dec 21, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.3.2)
// ----
@mixin generate-grid($col: 12) {
@for $i from 1 to $col + 1 {
.col-#{$i} { flex: 0 0 percentage($i/$col); }
}
}