This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Format a string with values from the provided object. | |
* | |
* @param {string} template - String with {} denoted keys. (See example) | |
* @param {object} args - Key/value pairs matching the holes in the template. | |
* @return {string} | |
* | |
* @example | |
* format('This is a {language} ({abbr}) codebase.', { | |
* language: 'JavaScript', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hello() { | |
console.log('hello from a github gist'); | |
} | |
module.exports = hello; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find all possible sum of cubes for a particular number | |
* @param {Number} Number to find all sum of cube pairs | |
* @return {Array} Array of sum of cubes | |
*/ | |
function findAllPossiblePairs(n) { | |
var doneFinding = false; | |
var i = 1; | |
var found = []; | |
var j = Math.floor(Math.pow(n, 1/3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Increment number represented in array | |
* | |
* E.g. Take [1, 2, 3] increment to [1, 2, 4] | |
* @param {[Number]} arr Array to increment | |
* @return {[Number]} Array of numbers | |
*/ | |
function increment(arr) { | |
for(var i = arr.length - 1; i >= 0; i--) { | |
if(arr[i] === 9) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.heart { | |
font-size: 200pt; | |
line-height: 0.9; | |
text-align: center; | |
color: red; | |
-webkit-animation:beat 0.6s infinite; /* Chrome, Safari, Opera */ | |
-moz-animation:beat 0.6s infinite; | |
animation:beat 0.6s infinite; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
gem update | |
brew update | |
brew upgrade | |
upgrade_oh_my_zsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (fizzbuzz n limit) | |
(cond | |
((eq? (modulo n 15) 0) | |
(printf "~a: FizzBuzz~n" n)) | |
((eq? (modulo n 3) 0) | |
(printf "~a: Fizz~n" n)) | |
((eq? (modulo n 5) 0) | |
(printf "~a: Buzz~n" n))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JavaScript | |
[] || 'hello' // returns [] | |
# Python | |
[] or 'hello' # returns 'hello' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo 'Deploying...' | |
apt-get install -y nginx | |
service nginx start | |
update-rc.d nginx defaults | |
docker build -t ryanseys/hello github.com/ryanseys/node-helloworld | |
docker run -d ryanseys/hello | |
docker ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:12.04 | |
MAINTAINER Ryan Seys <ryan@ryanseys.com> | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise universe" >> /etc/apt/sources.list | |
RUN apt-get update # DATE: 2013/10/26 | |
RUN apt-get upgrade -y | |
RUN apt-get install -y python-software-properties python g++ make software-properties-common | |
RUN add-apt-repository ppa:chris-lea/node.js && apt-get update | |
RUN apt-get install -y nodejs | |
ADD . /src | |
RUN cd /src; npm install |