Skip to content

Instantly share code, notes, and snippets.

@notionparallax
notionparallax / keymapping.js
Created July 3, 2014 03:25
an object that maps the key codes of strange keys to a string so that they can be logged more easily.
var keyMappings = {
8:"backspace",
9:"tab",
13:"enter",
16:"shift",
17:"ctrl",
18:"alt",
19:"pause break",
20:"caps lock",
27:"escape",
baseURL = "http://your.IP.add.ress"
password = "password"
username = "username"
require 'net/http'
require "uri"
require 'json'
def ask_oa(request, baseURL, params, username, password)
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
#from clr import AddReference as addr
#addr("Grasshopper")
#from System import Object
#from Grasshopper import DataTree
#from Grasshopper.Kernel.Data import GH_Path
import random
// getRowsData iterates row by row in the input range and returns an array of objects.
// Each object contains all the data for a given row, indexed by its normalized column name.
// Arguments:
// - sheet: the sheet object that contains the data to be processed
// - range: the exact range of cells where the data is stored
// - columnHeadersRowIndex: specifies the row number where the column names are stored.
// This argument is optional and it defaults to the row immediately above range;
// Returns an Array of objects.
function getRowsData(sheet, range, columnHeadersRowIndex) {
columnHeadersRowIndex = columnHeadersRowIndex || range.getRowIndex() - 1;

This is a plugin meant for Jekyll.

It's a fork of joelverhagen's youtube plugin. This version is for bootstrap responsive embed.

Width and height don't really mean anything as they are overridden by the bootstrap aspect ratio class name.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

--------------------------------------------------------------------------------------------------------------------------- Class 1
public class Script_Instance : GH_ScriptInstance
{
#region Utility functions
/// <summary>Print a String to the [Out] Parameter of the Script component.</summary>
/// <param name="text">String to print.</param>
private void Print(string text) { /* Implementation hidden. */ }
/// <summary>Print a formatted String to the [Out] Parameter of the Script component.</summary>
/// <param name="format">String format.</param>
/// <param name="args">Formatting parameters.</param>
function servePhoto(request) {
var storageUrl = request.url.replace(/-\d+px\.jpg$/, '');
return caches.open(contentImgsCache).then(function(cache) {
return cache.match(storageUrl).then(function(response) {
if (response) return response;
return fetch(request).then(function(networkResponse) {
cache.put(storageUrl, networkResponse.clone());
return networkResponse;
@notionparallax
notionparallax / possible_usernames.py
Created June 22, 2016 18:27
My twitter name is a bit long. I was wondering if there were any good, shorter ones out there. This is a naive way of finding out, but it gets banned by twitter pretty quickly.
#example response: {"valid":false,"reason":"taken","msg":"Username has already been taken","desc":"That username has been taken. Please choose another."}
permissableChars = list("abcdefghijklmnopqrstuvwxyz_1234567890")
import json
import urllib2
import itertools
possibleUsernames = []
import itertools
import random
colours = ["#e67e22","#f1c40f","#27ae60","#1abc9c","#2980b9","#c0392b"]
places = ["Verandah","Kitchen","Toilet","Shower","Desk","Someone else's desk","Meeting N","Meeting S","Quiet N","Quiet S"]
pairs = itertools.combinations(places, 2)
pairs = list(pairs)