Skip to content

Instantly share code, notes, and snippets.

View everyplace's full-sized avatar

Erin Sparling everyplace

View GitHub Profile
@danheberden
danheberden / finddata.jquery.js
Created June 27, 2011 14:21
findData plugin - search by data-KEY=VALUE on and in current jQ collection
/*
* by Dan Heberden / 2011
* demo at http://jsfiddle.net/danheberden/VjKMY/
* made just for Elijah Manor
* e.g.
* $( 'div' ).findData( 'theDataKey', 'theValue' );
*
* will search in the divs and their children
*/
(function( $ ){
@elithompson
elithompson / turntable-track-muter.js
Created June 29, 2011 02:22
Mute until next track starts
(function(){
function toggleMute() {
$(".mute_btn:first").click();
}
toggleMute();
console.log("muted!");
var $messagesDiv = $(".messages");
function onMessageReceived(event) {
if (event.target.tagName !== "DIV") {
@RandomEtc
RandomEtc / 1-make-key
Created September 16, 2011 16:35
generating SSL keys and Certificate Signing Requests for Heroku / Nginx / RapidSSL
Key was generated using:
tom% openssl genrsa -des3 -out example.com.key 2048
Generating RSA private key, 2048 bit long modulus
....+++
..........................................................................................................................+++
e is 65537 (0x10001)
Enter pass phrase for example.com.key:
Verifying - Enter pass phrase for example.com.key:
%tom
@tmiz
tmiz / CoreLocationTest.m
Created December 1, 2011 12:08
Using CoreLocation on Mac OS X with command-line
//
// Using CoreLocation on Mac OS X with command-line
// $ clang CoreLocationTest.m -framework cocoa -framework CoreLocation
// $ ./a.out
// location service enabled
// 2011-12-01 21:03:01.839 a.out[10214:903] latitude,logitude : 35.606647, 140.695538
// 2011-12-01 21:03:01.842 a.out[10214:903] timestamp : 2011-12-01 21:01:36 +0900
// tmiz [email protected]
//
#import <cocoa/cocoa.h>
@reinhrst
reinhrst / gist:4341358
Created December 19, 2012 22:57
Capacitive touch on electic imp. Just load the code, and touch pin 1!
//Checks for touch
imp.configure("Touch", [], []);
function test() {
local cycles = 0;
hardware.pin1.configure(DIGITAL_OUT);
hardware.pin1.write(1);
imp.sleep(0.01);
hardware.pin1.configure(DIGITAL_IN);

Lesson's learnt building the Guardian

Below is a collection of my favourite responses I gathered from Guardian engineers when asked the question: What have you learnt starting from scratch and building a mobile-first next generation web platform for the Guardian?

Daithi O Crualaoich

  • Work with great people.
  • Deploy like crazy. This means the team has to control the infrastructure as well as code.
  • Design is not a service. Designers have to sit in the team.
  • Infrastructure is intrinsically unreliable. Discard and replace is the robust strategy.
  • Use your CDN for HTML too.
  • Don't always do as you are told.
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
@mpalpha
mpalpha / node_mac.sh
Last active February 2, 2022 00:58
Use npm global without sudo on OSX
#!/bin/bash
#
# Install or Update Homebrew as needed
#
which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
# https://github.com/mxcl/homebrew/wiki/installation
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@daaru00
daaru00 / template.yml
Created June 15, 2021 08:47
A SAM template that describe an Amazon CloudFront distribution that redirect all request to a specific URL using a CloudFront Function
AWSTemplateFormatVersion: 2010-09-09
Transform:
- AWS::Serverless-2016-10-31
# Template Information
Description: "Website redirect"
# Template Parameters