Skip to content

Instantly share code, notes, and snippets.

View jimmont's full-sized avatar

Jim Montgomery jimmont

View GitHub Profile
@Rnhatch
Rnhatch / index.html
Last active April 12, 2017 01:08
D3 Blocks: Play with transitions and color scales of 1000 blocks.
<!DOCTYPE html>
<html>
<head>
<!--<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />-->
<title>Tutorial: introduction to D3</title>
<script type="text/javascript" src="array.js"></script>
<script type="text/javascript" src="string.js"></script>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
@spiralx
spiralx / computed-property.js
Created January 26, 2016 18:56
Use ES6 Proxy to attach computed properties
'use strict';
const VALUE = Symbol.for('value')
function addComputedProperty(obj, name, func) {
let _computed = func(obj)
return new Proxy(obj, {
get(target, key, receiver) {
if (key === name) {
@emilisto
emilisto / injection-proxy.js
Created May 25, 2012 10:39
A content replacing proxy in node.js
//
// injection-proxy.js
// Emil Stenqvist <emsten@gmail.com>
//
// Free for all!
//
// A content-replacing proxy in node.js.
//
// I made this for debugging JavaScript on a live website.
//
tell application "Safari"
activate
delay 1.5
tell application "System Events"
tell process "Safari"
set frontmost to true
click menu item 2 of menu 1 of menu item "iPhone Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
end tell
end tell
end tell
@auser
auser / googleServices.js
Last active May 11, 2018 09:18
Part of the code for the Beginner's Guide to AngularJS
'use strict';
var __gapiAvailable = function() {
return typeof(gapi) !== 'undefined';
}
angular.module('myApp.services', [])
.value('version', '0.0.1');
// Our google services module
@brianherman
brianherman / jessie-mssql.md
Last active June 15, 2018 19:00
Debian Jessie and mssql-server

Download mssql from the microsoft website.

wget https://packages.microsoft.com/ubuntu/16.04/mssql-server/pool/main/m/mssql-server/mssql-server_14.0.1.246-6_amd64.deb

dpkg -i mssql-server_14.0.1.246-6_amd64.deb 

The next command will install dependancies.

sudo apt-get -f install 
@igrigorik
igrigorik / gist:3148848
Created July 20, 2012 05:24
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
{ ~ } > ./youtube-dl -s -F http://www.youtube.com/watch?v=vT1KmTQ-1Os
@trodrigues
trodrigues / gist:7414091
Last active August 30, 2019 03:24
Angular.js directive test example with service mocking
describe('Directive test', function () {
var container, scope;
var aStub;
beforeEach(function () {
aStub = sinon.stub();
module('testmodule', function ($provide) {
$provide.value('someService', aStub);
});
@melanke
melanke / MultiGetSet.js
Created June 19, 2012 20:53
MultiGetSet.JS - Quickly generate getters and setters for multiple attributes
var MultiGetSet = function(opt){
var getType = function(o) {
return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
};
if(!opt.public || !opt.private)
return opt.public;
if(opt.handler && opt.handler.init)
@FrankGrimm
FrankGrimm / nodepost-1.js
Created November 9, 2010 15:31
HTTP body in node.js
var http = require('http');
http.createServer(function (req, res) {
// set up some routes
switch(req.url) {
case '/':
console.log("[501] " + req.method + " to " + req.url);
res.writeHead(501, "Not implemented", {'Content-Type': 'text/html'});
res.end('<html><head><title>501 - Not implemented</title></head><body><h1>Not implemented!</h1></body></html>');
break;