Skip to content

Instantly share code, notes, and snippets.

@Integralist
Integralist / Ruby Decorator Design Pattern for BBC.rb
Last active January 6, 2016 13:38
Ruby Decorator Design Pattern for BBC: with a little imagination you can see how we could store data in S3 instead of "printing" it to the screen AND also how we could have some models extend based on a whitelist (as some components you'll want to extend ALL formatters, and other components you'll only want to extend from one or two formatters)
require "json"
module HtmlFormatter
def render
p "<p>HTML content</p>"
super
end
end
module JsonFormatter
if (!Object.delegate) {
Object.delegate = function $delegate$(delgObj,obj) {
if (!obj) obj = {};
if (Object.setPrototypeOf) return Object.setPrototypeOf(obj,delgObj);
return Object.assign(Object.create(delgObj),obj);
}
}
@paulirish
paulirish / bling.js
Last active July 23, 2024 01:12
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@jcleveley-zz
jcleveley-zz / zsh.md
Last active March 21, 2016 14:18
Zsh tips

Path replacement

Moving from: /www/site1/media/css/main to /www/site2/media/css/main can be a pain, but not in zsh:

cd site1 site2
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
require 'wraith'
@config = 'configs/new.yaml'
@config2 = 'configs/old.yaml'
@wraith = Wraith::CLI.new
def history(config)
@wraith.reset_shots(config)
@wraith.setup_folders(config)
@wraith.save_images(config)
@maxluster
maxluster / responsive.scss
Last active February 4, 2019 21:24
Responsive SASS: Chain media queries and coordinate named breakpoints
// Created by Max Luster (@maxluster)
// Usage instructions at https://bugsnag.com/blog/responsive-typography-with-chained-media-queries
// Requires SASS >= 3.3
// Enhanced by Breakpoint 2.4.x and Compass 1.0 (alpha)
// For SASS 3.2.x support, use https://gist.github.com/maxluster/c9ecc6e4a6770e507c2c
// Provides a simplified syntax for chaining media queries across named or numeric breakpoints
@mixin responsive($properties, $default-value, $responsive-values){
// No named breakpoints by default

GitHub merge queue

This is how I think we could automate the process of merging pull requests:

  • Create a merge-queue.json file and add it to the responsive codebase.
  • Ignore file in .gitignore.
  • Add the name of a branch and email to the file. For example:
  {
 "branch-name-1": "developer1@bbc.co.uk",
@madrobby
madrobby / gist:9476733
Created March 10, 2014 23:34
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
# == WHAT
# Simple script for irssi to trigger Mac OS X 10.8's Notification Center
#
# == WHO
# Patrick Kontschak 2012
#
# Forked from Nate Murray's irssi-growl: https://github.com/jashmenn/irssi-growl
#
# == CONFIG
# /SET notifier_on_regex [regex]