Skip to content

Instantly share code, notes, and snippets.

View RyanCCollins's full-sized avatar

Ryan Collins RyanCCollins

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

Install NVM to manage NodeJS versions

Download and Install

Download and run the install script using curl:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash

or use wget:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
@RyanCCollins
RyanCCollins / npm-install-without-sudo.md
Created January 18, 2016 17:28
NPM Install without SUDO

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 https://releases.hashicorp.com/packer/0.8.6/packer_0.8.6_darwin_amd64.zip
unzip packer_0.8.6_darwin_amd64.zip
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"
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: "" };

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.

@RyanCCollins
RyanCCollins / curry
Last active July 1, 2016 04:33
FP in JS
const say = (what) =>
(times) =>
[...Array(times||0)].map((v,i)=>i).forEach((_) => console.log(what))
say("What")(30)
@RyanCCollins
RyanCCollins / thunks-rock.js
Last active August 31, 2016 01:32
Forget Callback inversion of control, thunks are the way to go!
// Playing with Thunks
// See: http://jsbin.com/qebuluveje/edit?js,console
// Awesome!
const fakeAjax = (text, cb) =>
setTimeout(() => {
cb(text);
}, 5000);
function getFile(file) {
var text, fn;
@RyanCCollins
RyanCCollins / array-from-range.md
Created September 2, 2016 02:57
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.call, Number)

Another option

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