Skip to content

Instantly share code, notes, and snippets.

@colinbdclark
colinbdclark / imperative-adhoc-additive-synthesis.js
Last active August 29, 2015 14:17
Imperative Ad-Hoc Additive Synthesis (Clarinet)
var fundamental = 440,
harmonics = [1, 3, 5, 7, 9, 13, 15], // Clarinets only have odd partials.
baseHarmonicDef = {
ugen: "flock.ugen.saw",
freq: 440,
mul: {
ugen: "flock.ugen.envGen",
envelope: {
type: "flock.envelope.adsr",
attack: 0.1,
@turadg
turadg / poltergeist_screenshot_helper.rb
Last active December 15, 2015 20:59
Poltergeist screenshot helper for Rspec
# spec/support/poltergeist_screenshot_helper.rb
module PoltergeistScreenshotHelper
# FROM http://blog.jerodsanto.net/2012/12/capybara-and-poltergeist-snap/
def snap!(options={})
path = options.fetch :path, "~/.Trash"
file = options.fetch :file, "#{Time.now.to_i}.png"
full = options.fetch :full, true
path = File.expand_path path
@aibrean
aibrean / map-scroll.js
Created February 11, 2015 20:55
Enable Google map zooming on click only (disable scrolling)
// Disable scroll zooming and bind back the click event
var onMapMouseleaveHandler = function (event) {
var that = $(this);
that.on('click', onMapClickHandler);
that.off('mouseleave', onMapMouseleaveHandler);
that.find('iframe').css("pointer-events", "none");
// pointer-events needs to be added as a style on the iframe
}
@cubicleDowns
cubicleDowns / marqueeselection.js
Last active December 23, 2017 00:22
Drag and Drop Marquee Selection with THREE.js and WebGL.
function listeners () {
demo.jqContainer.mousedown(mouseDown);
demo.jqContainer.mouseup(mouseUp);
demo.jqContainer.mousemove(marqueeSelect);
$(document).mousemove(resetMarquee);
}
function resetMarquee () {
mouseup = true;
mousedown = false;
@jkresner
jkresner / Procfile
Created April 13, 2013 09:05
Deploy brunch to heroku
web: ./node_modules/.bin/coffee app.coffee
@jpoehls
jpoehls / gist:5521004
Created May 5, 2013 14:43
hasOwnProperty() example
function rightWay(obj) {
for (var key in obj) {
// Ignore properties that are inherited.
if (!obj.hasOwnProperty(key)) {
continue;
}
console.log(key);
}
}
@moluapple
moluapple / gist:2719021
Created May 17, 2012 13:44
AI CS6 Application.executeMenuCommand(menuCommandString: string ) 方法参数列表
menuCommandString,UI MenuString zh_CN
-------------------------------------
new,新建
newFromTemplate,从模板新建
open,打开
saveacopy,存储副本
Adobe AI Save For Web,存储为 Web 所用格式(W)
Adobe AI Save Selected Slices,存储选中的切片
revert,恢复
AI Place,置入(L)
@lorenzopolidori
lorenzopolidori / has3d.js
Last active December 4, 2020 10:52 — forked from webinista/has3d.js
Testing for CSS 3D Transforms Support
function has3d(){
if (!window.getComputedStyle) {
return false;
}
var el = document.createElement('p'),
has3d,
transforms = {
'webkitTransform':'-webkit-transform',
'OTransform':'-o-transform',
@impankratov
impankratov / handlebars.js
Last active September 8, 2021 15:59
Example of registering custom handlebars helpers (+ handlebars-form-helpers) with webpack
// Import Handlebars runtime lib
const Handlebars = require('handlebars/runtime');
const register = require('handlebars-form-helpers').register;
const { registerHandlebarHelpers } = require('../../some/other/place');
// Register extra helpers
register(Handlebars);
registerHandlebarHelpers(Handlebars);
@blowdart
blowdart / UpdateIISExpressSSLForChome.ps1
Last active October 7, 2021 10:59
IIS Express certs (for now) don't contain SAN strings. This makes Chrome unhappy. Make Chrome happy again with a new organic, artisanal, gluten free HTTPS certificate.
# Create a new self signed HTTPS Certificate for IIS Express
# Crafted with all organic, GMO, gluten free ingreditations
# with an artisinal SAN to make Chrome 58 onwards happy.
#
# See https://bugs.chromium.org/p/chromium/issues/detail?id=308330
#
# Run this at an administrative PowerShell prompt.
#
# You will be prompted to trust a new certificate via a windows dialog.
# Click yes otherwise Visual Studio will not be able to determine your