Skip to content

Instantly share code, notes, and snippets.

@edds
edds / README.md
Created September 4, 2011 08:21
Socket.IO example to stream tweets on a topic

A simple example to create a websocket server and stream tweets about a pre-defined subject to the page.

Installation

$ npm install socket.io, twitter

Run

$ node ./app.js
@edds
edds / index.html
Created September 4, 2011 08:32
Javscript LED Scroller implementation.
<!doctype html>
<title>LED Scroller</title>
<style>
div#scroller {
width: 720px;
background:#000;
border:3px solid #000;
overflow:hidden;
@edds
edds / index.html
Created April 19, 2012 11:08
Dynamic SVG Mask - make a spotlight mask over an element
<!doctype html>
<title>Dynamic SVG Mask</title>
<style>
div {
width: 800px;
height: 800px;
background: #000;
}
</style>
@edds
edds / index.html
Created April 19, 2012 21:04
Ball that reacts to gravity on iOS devices
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
div {
width: 100px;
height: 100px;
background: #000;
color: #fff;
position: absolute;
@edds
edds / git-flow.md
Last active December 20, 2015 11:00
Basic git workflow

A basic workflow to create a new branch, do work on it:

$ git pull

$ git checkout -b <branchname>

... code edits ...

$ git [add|rm] <files>
@edds
edds / toolkit_test.sh
Created October 8, 2013 07:42
Test the creation of buttons using the govuk_frontend_toolkit.
#!/bin/bash
# Make folder for our test and cd into it
mkdir toolkit_test
cd toolkit_test
# Clone down a new copy of the toolkit
git clone https://github.com/alphagov/govuk_frontend_toolkit.git
# Make sub folder for the test so the toolkit isn't in a child folder
@edds
edds / token.rb
Created March 5, 2014 09:04
Generate a Google api refresh token to authenticate API requests
# Pre-requisites are that you have installed the oauth2 gem using:
# gem install oauth2
# Then call this file using `ruby token.rb` and follow the instructions.
require 'rubygems'
require 'oauth2'
redirect_uri = 'https://localhost/oauth2callback'
puts "Make sure #{redirect_uri} is set as a 'Redirect URI' in the Google Conosle for the project you want to create a token for.\n"
@edds
edds / application.scss
Created October 8, 2014 12:23
Demonstration of the new grid system
@import 'grid_layout';
@import "typography";
#wrapper {
@extend %full-width-wrapper;
}
.grid-row {
@extend %grid-row;
.third-column {
@edds
edds / mustache_template.rb
Last active August 29, 2015 14:11
Render mustache templates natively in Rails using a template handler
# ./config/initializers/mustache_template.rb
class MustacheTemplate
# `call` returns a string which is evaled in the context of the action view
# This follows the same pattern as other handlers:
# https://github.com/rails/rails/tree/4-2-stable/actionview/lib/action_view/template/handlers
def call(template)
partial_prefix = File.basename(File.dirname(template.identifier))
<<-cmd
mustache_template = Mustache.new
mustache_template.instance_variable_set("@view_paths", view_paths)
@edds
edds / repos.json
Created June 30, 2015 12:06
core team fourth wall
[
{ "userName": "alphagov", "repo": "signonotron2" },
{ "userName": "alphagov", "repo": "frontend" },
{ "userName": "alphagov", "repo": "maslow" },
{ "userName": "alphagov", "repo": "short-url-manager" },
{ "userName": "alphagov", "repo": "support" },
{ "userName": "alphagov", "repo": "specialist-publisher" },
{ "userName": "alphagov", "repo": "publisher" },
{ "userName": "alphagov", "repo": "whitehall" },
{ "userName": "alphagov", "repo": "govuk_content_api" },