Skip to content

Instantly share code, notes, and snippets.

View averyvery's full-sized avatar

Doug Avery averyvery

View GitHub Profile
@averyvery
averyvery / dimension.scss
Created January 31, 2017 19:54
lil trick
/*
example:
dimension(foo, bar, 2, 10px);
- gets the value bar inside foo map
- multiplies it by two
- adds 10px
*/
$dimensions: (
global: (
// better describe() method that nests your describe blocks
// if you pass it a string with slashes
(function() {
var recursiveNestedDescribe = function(title, callback) {
var titleChunk = title.shift();
if (title.length === 0) {
describe(titleChunk, callback);
} else {
describe('/' + titleChunk, function() {
require('colors');
import webpack from 'webpack';
import prettysize from 'prettysize';
import fs from 'fs';
import { execSync } from 'child_process';
import Table from 'cli-table';
import config from '../config/build.js';
webpack(config).run((error, stats) => {
if (error) console.log(error.red);
#!/usr/bin/env ruby
# coding: utf-8
require 'pbcopy'
project_data = File.read('projects.csv')
hours_data = File.read('hours.csv')
projects = project_data.split(/\n/)
projects.shift
import store from 'data/store'
import browser from 'browser'
import Intro from './Intro'
import LevelEnd from './LevelEnd'
import Questions from './Questions'
import TimeoutTransitionGroup from 'vendor/timeout-transition-group'
export default React.createClass({
_getScreen() {
const level = store.getLevel(this.props.level)
@averyvery
averyvery / svg.jsx
Created April 14, 2015 18:42
svg.jsx
// option for inlining (for index)
// option for caching (for SVGs used more than once)
export default React.createClass({
getInitialState() {
return {
svg: ''
}
},
module.exports = React.createClass({
getInitialState() {
return {
usingMouse : false,
focusedOnElement : false
}
},
_setUsingMouse(usingMouse) {
this.setState({usingMouse: usingMouse})
▓█████▄ ▒█████ █ ██ ▄████ ▄▄▄ ██▒ █▓▓█████ ██▀███ ▓██ ██▓
▒██▀ ██▌▒██▒ ██▒ ██ ▓██▒ ██▒ ▀█▒ ▒████▄ ▓██░ █▒▓█ ▀ ▓██ ▒ ██▒▒██ ██▒
░██ █▌▒██░ ██▒▓██ ▒██░▒██░▄▄▄░ ▒██ ▀█▄▓██ █▒░▒███ ▓██ ░▄█ ▒ ▒██ ██░
░▓█▄ ▌▒██ ██░▓▓█ ░██░░▓█ ██▓ ░██▄▄▄▄██▒██ █░░▒▓█ ▄ ▒██▀▀█▄ ░ ▐██▓░
░▒████▓ ░ ████▓▒░▒▒█████▓ ░▒▓███▀▒ ▓█ ▓██▒▒▀█░ ░▒████▒░██▓ ▒██▒ ░ ██▒▓░
▒▒▓ ▒ ░ ▒░▒░▒░ ░▒▓▒ ▒ ▒ ░▒ ▒ ▒▒ ▓▒█░░ ▐░ ░░ ▒░ ░░ ▒▓ ░▒▓░ ██▒▒▒
░ ▒ ▒ ░ ▒ ▒░ ░░▒░ ░ ░ ░ ░ ▒ ▒▒ ░░ ░░ ░ ░ ░ ░▒ ░ ▒░▓██ ░▒░
░ ░ ░ ░ ░ ░ ▒ ░░░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░░ ░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░
@averyvery
averyvery / spread.sass
Last active May 16, 2020 22:07
spread.sass
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
@averyvery
averyvery / distribute.sass
Last active August 29, 2015 14:12
Smooth CSS property distribution with media queries
=distribute($property, $min, $max, $start, $end, $precision, $metric)
#{$property}: $min
// get the range we're operating on
$range: $end - $start
// get the number of iterations we need to run by seeing how precise we should be
$loops: strip-units(ceil($range / $precision)) - 1