Skip to content

Instantly share code, notes, and snippets.

View philnash's full-sized avatar
🦕

Phil Nash philnash

🦕
View GitHub Profile
@philnash
philnash / placekitten.coffee
Created November 11, 2011 17:06
placekitten.coffee
# hubot kitten <width>x<height> - get a kitten image
module.exports = (robot) ->
robot.respond /kitten(\s\d+(x\d+)?)?$/i, (msg) ->
size = msg.match[1]
sizes = size.split('x') if size?
if sizes
if sizes.length > 1
width = sizes[0].trim()
height = sizes[1].trim()
@philnash
philnash / dabblet.css
Created May 21, 2012 23:37
CSS loading animation
/**
* CSS loading animation
*/
@keyframes fade{
from {
opacity:1;
}
to {
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
alias update="git pull && (bundle check || bundle install) && rake db:migrate db:test:prepare && powder -r"
@philnash
philnash / Output
Last active December 31, 2015 19:59
Shoulda + Minitest 5
$ ruby testcase.rb
MiniTest::Unit::TestCase is now Minitest::Test. From /Users/philnash/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:8:in `<module:Unit>'
Run options: --seed 59078
# Running:
Finished in 0.001670s, 0.0000 runs/s, 0.0000 assertions/s.
@philnash
philnash / benchmark.rb
Last active August 29, 2015 14:17
A Benchmark of Array detect against lazy select and first
# A Benchmark of Array detect against lazy select and first
#
# Inspired by https://gist.github.com/ernie/1086770
require 'benchmark'
haystack = (1..1_000_000).to_a
needles = 1.upto(100).map {|n| n * 10_000}
puts "\n" + '=' * 80
var http = require('http');
var twilio = require('twilio');
var qs = require('querystring');
http.createServer(function (req, res) {
var body = '';
req.setEncoding('utf8');
req.on('data', function(data) {
body += data;
<!DOCTYPE html>
<html>
<head>
<title>Fetch test</title>
</head>
<body>
<main>
<h1>Press this button</h1>
<button id="btn">Press me</button>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Camera selection</title>
<style>
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json