Skip to content

Instantly share code, notes, and snippets.

View KingScooty's full-sized avatar
🚀

Scotty Vernon KingScooty

🚀
View GitHub Profile
@kenoir
kenoir / gist:3618577
Created September 4, 2012 08:37
Proxy stuff for reith
> cat ~/proxies_off
#!/bin/sh
echo "Proxies OFF"
unset HTTP_PROXY
unset ALL_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
@fson
fson / rapid-prototyping-with-relay.md
Created October 18, 2015 20:08
Rapid prototyping with Relay (Reactive 2015 lightning talk proposal)

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

Rapid prototyping with Relay

Relay makes data fetching in React apps simpler, by letting you declare the data needs of your components instead of writing complex imperative code. React, Relay, GraphQL and the other complementary tools are changing how apps are built.

@nicholascloud
nicholascloud / blog-npm-root-packages.md
Last active December 16, 2015 03:49
blog-npm-root-packages

The problem

When I list my npm packages with npm ls -g (or without the -g option for a local node_modules directory) I see all installed packages and their dependencies. Like so:

$ npm ls -g
├─┬ anvil.js@0.9.0-RC3.1
│ ├── colors@0.6.0
│ ├─┬ commander@1.1.1
│ │ └── keypress@0.1.0
@crstn
crstn / gist:6552662
Last active December 23, 2015 00:19
Transforms JSON files exported from the moves API [1] into GeoJSON, which can then be used in a number of applications, such as CartoDB or Leaflet. [1] http://dev.moves-app.com
<?php
// this is the directory where you have your json files from the moves API stored
$dir = "/my/input/dir";
// this is where your geojson files will be stored
$outdir = "/my/output/dir";
$geojsonplaces = [
"type" => "FeatureCollection",
"features" => [ ],
];
@zeroasterisk
zeroasterisk / function
Created April 11, 2013 05:10
Example usage of Handlebars.registerHelper("foreach"... from http://stackoverflow.com/a/12002281/194105
Handlebars.registerHelper("foreach",function(arr,options) {
if(options.inverse && !arr.length)
return options.inverse(this);
return arr.map(function(item,index) {
item.$index = index;
item.$first = index === 0;
item.$last = index === arr.length-1;
return options.fn(item);
}).join('');
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&amp;')
.replace(/>/g,'&gt;')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@sehrgut
sehrgut / LetterpressSizes.json
Last active April 19, 2018 12:43
Traditional letterpress point size names, in JSON
/*
* Transcribed to JSON from http://en.wikipedia.org/wiki/Point_(typography)#Traditional_point-size_names
* This document is free and open-source software licensed simultaneously under the MIT License, the GPL v2,
* and the two-clause BSD License.
*
* nb. Where conflicts in naming existed (Double Small Pica and Double Pica), the British unit took
* precedence. In all other cases, both US and British units are described.
*/
{
"LetterpressSizes": {
@dvessel
dvessel / r-em-sizing.scss
Last active October 30, 2018 09:59
font-size in rem and a tool for absolute to em conversion. http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
// Inspired by this post from CSS-Tricks.
// http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
//
// Plays nice with compass/typography/vertical_rhythm
// http://compass-style.org/reference/compass/typography/vertical_rhythm/
//
// Calculates font size in `rem` (root em).
//
// Relative values depends on $base-font-size. Pixle value for font-size depends
// on $legacy-support-for-ie6 or $legacy-support-for-ie7 or $legacy-support-for-ie8

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

// place this file in __mocks__
let pendingAssertions
exports.prompt = prompts => {
if (!pendingAssertions) {
throw new Error(`inquirer was mocked and used without pending assertions: ${prompts}`)
}
const answers = {}