Skip to content

Instantly share code, notes, and snippets.


Ryan Collins RyanCCollins

View GitHub Profile
RyanCCollins / category_plugin.rb
Created Oct 21, 2015 — forked from somic/category_plugin.rb
How I organize posts in Jekyll (code snippets for blog post - see comments)
View category_plugin.rb
module Jekyll
Page.class_eval {
def clone, @base, @dir, @name)
RyanCCollins / Gruntfile.js
Created Jan 16, 2016
How to start mongo with Grunt
View Gruntfile.js
shell: {
mongo: {
command: "sh",
options: {
async: true

Install NVM to manage NodeJS versions

Download and Install

Download and run the install script using curl:

curl -o- | bash

or use wget:

wget -qO- | bash

NPM install without SUDO

It's easy! Just change permissions on the .npm directory as shown below.

Try this:

sudo chown -R $(whoami) ~/.npm

Or this:

curl -O -L
sudo mv packer_0.8.6 /usr/local/packer
sudo chown $USER /usr/local/packer/
# then update your .bash_profile with the new path e.g.:
# export PATH="/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/local/packer:$PATH"
View react-lifecycle-parent-child.jsx
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
View privacy_policy.markdown

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.

View curry
const say = (what) =>
(times) =>
[...Array(times||0)].map((v,i)=>i).forEach((_) => console.log(what))
RyanCCollins / thunks-rock.js
Last active Aug 31, 2016
Forget Callback inversion of control, thunks are the way to go!
View thunks-rock.js
// Playing with Thunks
// See:,console
// Awesome!
const fakeAjax = (text, cb) =>
setTimeout(() => {
}, 5000);
function getFile(file) {
var text, fn;
RyanCCollins /
Created Sep 2, 2016
Create an array of 1 through n numbers in one line of JS

Create an array of numbers 1 to N

const N = 20;
Array.apply(null, { length: N }).map(, Number)

Another option

const arrayOfRange = (n) => Array(n).join().split(',').map((_, i) => i);