Skip to content

Instantly share code, notes, and snippets.

use v5.14;
use JSON::PP;
use JSON::Hyper;
use Data::Dumper;
use Devel::Confess;
# Construct a URI which has some JSON data. I'm using a
# data: URI because I'm too lazy to upload some JSON
# somewhere, but any URI that returns JSON should be OK.
#
@robhawkes
robhawkes / twitter.js
Created August 12, 2011 10:58
Twitter scraper in Node
// Reorder, rename, and document variables at some point
var sys = require("sys"),
twitter = require("ntwitter"),
mongoose = require("mongoose"),
db_user,
db_pass,
db_url,
db_port,
db_name,
coll,
@codeincontext
codeincontext / gist:1189597
Created September 2, 2011 19:24
mixing two audioboos with <audio>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
// file://localhost/Users/skattyadz/code/audio/index.htm?boo1=157217&boo2=3113
$(document).ready(function(){
var audio1 = document.createElement('audio');
var audio2 = document.createElement('audio');
audio1.volume=0.5;
@RonnyO
RonnyO / localive.js
Last active September 30, 2015 21:58
Conditional loading of live.js for dev environments
// Load live.js on local envs only
// Make sure the path is right and your dev env passes the test.
/* Delete these characters to disable it temporarily -> */
(function() {
if(/^https?:\/\/(localhost|127.0.0.1)|^file:\/\/\//.test(document.location.href)) {
var live = document.createElement('script');
live.src = 'js/live.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(live, s);
@bengourley
bengourley / gist:2152795
Created March 21, 2012 21:00
Setting up OS X from scratch

Setting up my fresh OS X install from scratch:

  • Install xcode (once installed go to Xcode->Preferences->Components to download command line tools, then sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ to point to things like opendiff)
  • Install purchased apps from AppStore
  • Install Dropbox
  • Install Chrome, Firefox
  • Install brew
  • brew install git
  • brew install mongo
  • mkdir -p /data/db sudo chgrp admin /data/db sudo chmod g+w /data/db
@jcsrb
jcsrb / dabblet.css
Created May 3, 2012 13:51
Top and Bottom inset shadow
/**
* Top and Bottom inset shadow
*/
#element{
background-color: #E3F2F7;
height: 55px;
position: relative; /* to position pseudo absolute*/
overflow: hidden; /* to cut of overflow shadow*/
@codeincontext
codeincontext / gist:3707167
Created September 12, 2012 14:53
Facebook and Twitter login with Sinatra
require 'rubygems'
require 'sinatra'
require 'json'
require 'omniauth'
require 'omniauth-facebook'
require 'omniauth-twitter'
class SinatraApp < Sinatra::Base
configure do
set :sessions, true
//
// Original Objective C version: https://gist.github.com/bobmoff/7110052
//
// Fix SpriteKit's SKNode bug on iOS 7 & 8: nodes capture touch events
// even when userInteractionEnabled is false and the nodes are hidden.
//
// Details:
// http://stackoverflow.com/questions/19511334/sprite-with-userinteractionenabled-set-to-yes-does-not-receive-touches-when-cove
//
// How to use:
@darkliquid
darkliquid / beautified.js
Last active August 22, 2019 02:28
Bookmarklet to estimate reading time of a page
javascript:(function () {
function getTextNodesIn(element) {
var wordcount = 0,
whitespace = /^\s*$/;
function getTextNode(node) {
// type 3 is a textnode
if (node.nodeType == 3) {
// We skip text nodes that are only whitespace
if (!whitespace.test(node.nodeValue)) {
@rtrouton
rtrouton / gist:2ca6f001b3cecb5037825c7f9d2e422e
Created April 28, 2017 16:13
Xcode iOS simulator download URLs (as of Xcode 8.3.1)
iOS 10.2 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_2-10.2.1.1484185528.dmg
iOS 10.1 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_1-10.1.1.1476902849.dmg
iOS 10.0 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_0-10.0.1.1474488730.dmg
iOS 9.3 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
iOS 9.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg
iOS 9.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_1-9.1.1.1446593668.dmg
iOS 9.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_0-9.0.1.1443554484.dmg
iOS 8.4 Simulator: https://devimages.a