Transition the background color of the page every 500ms using minimal css and javascript.
A Pen by Chris Mytton on CodePen.
Transition the background color of the page every 500ms using minimal css and javascript.
A Pen by Chris Mytton on CodePen.
#!/usr/bin/env ruby | |
require 'date' | |
require 'kramdown' | |
require 'erb' | |
abort "Usage: #$0 <posts_path>" if ARGV.empty? | |
Post = Struct.new(:path) do | |
def title | |
Date.strptime(File.basename(path, '.md'), '%Y-%m-%d').strftime('%d %B %Y') |
/node_modules/ |
var calculator = { | |
add: function (a, b) { | |
return a + b | |
}, | |
subtract: function (a, b) { | |
return a - b | |
}, | |
multiply: function (a, b) { | |
return a * b | |
}, |
// bookmarklet to introspect the source of current page | |
javascript:(function(d,h){h=d.documentElement.innerHTML;d.open();d.write('<pre>'+('<!DOCTYPE html><html>'+h+'</html>').replace(/[<>]/g,function(m){return{'<':'<','>':'>'}[m]})+'</pre>')})(document); |
module Idea | |
class Generator | |
def actions | |
@actions ||= %w{read write design contemplate} | |
end | |
def objects | |
@objects ||= ['code', 'books', 'art', 'poetry', 'blogs'] | |
end | |
window.onload = function () { | |
if (! document.querySelectorAll) { // Quick & Dirty way to tell the good browsers from the bad ones. | |
alert("Please upgrade your browser to view this site."); | |
} | |
}; |
[/Users/chris/Code/Ruby/gist-550144 (master)] ruby-1.9.2-p0 | |
$ time php php_string.php > /dev/null | |
real 0m0.237s | |
user 0m0.218s | |
sys 0m0.017s | |
[/Users/chris/Code/Ruby/gist-550144 (master)] ruby-1.9.2-p0 | |
$ time php php_array.php > /dev/null | |
real 0m0.249s |
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
# - a browser with WebSocket support | |
# | |
# Usage: | |
# ruby redis_pubsub_demo.rb | |
# |
#!/bin/sh | |
# Get a website ready to deploy with git | |
REPO_HOST='example.com' | |
REPO_PATH=$HOME/repos | |
# Check that the user has provided a directory to use and it exists | |
if [ ! "$1" ]; then | |
echo "Usage: $0 DIRECTORY" | |
echo "Where DIRECTORY is the folder that you want to contain the working copy" |