Skip to content

Instantly share code, notes, and snippets.

@vonWolfehaus
vonWolfehaus / basicEaseFunction.js
Last active August 29, 2015 14:07
Dampen a value to ease it to a target value
var damper = 0.5; // lower is slower
function ease(current, target) {
current += (target - current) * damper;
// fix Zeno's paradox: value is snapped if we're within fraction of a distance unit (usually a pixel)
if (Math.abs(target - current) < 1) {
current = target;
}
return current;
}
[
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+enter"], "command": "build" },
{ "keys": ["shift+delete"], "command": "left_delete" },
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+shift+v"], "command": "paste" }
]
$spinner-size = 60px;
$spinner-line-size = 3px;
$spinner-duration = 1500ms;
$color-accent = #1e76e3;
.spinner {
position: relative;
min-width: $spinner-size;
min-height: $spinner-size;
}
@vonWolfehaus
vonWolfehaus / Line interpolation
Created September 24, 2012 16:34
Simple interpolation technique for plotting missing points between two key points
function lineInterpolate(point1, point2, distance) {
var xabs = Math.abs( point1.x - point2.x );
var yabs = Math.abs( point1.y - point2.y );
var xdiff = point2.x - point1.x;
var ydiff = point2.y - point1.y;
var length = Math.sqrt( ( Math.pow( xabs, 2 ) + Math.pow( yabs, 2 ) ) );
var steps = length / distance;
var xstep = xdiff / steps;
var ystep = ydiff / steps;
@vonWolfehaus
vonWolfehaus / VonDefaultUserKeybindings.sublime-keymap
Last active October 13, 2015 04:18
My SublimeText2 awesome keybindings
[
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+enter"], "command": "build" },
{ "keys": ["shift+delete"], "command": "left_delete" },
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } }
]
@vonWolfehaus
vonWolfehaus / VonPreferences.sublime-settings
Last active October 13, 2015 04:18
Settings I'm most comfortable with using in SublimeText2
{
"bold_folder_labels": true,
"caret_style": "phase",
"default_line_ending": "unix",
"detect_indentation": true,
"dictionary": "Packages/Language - English/en_US.dic",
"enable_tab_scrolling": false,
"fade_fold_buttons": false,
"font_size": 9,
"highlight_line": true,
@vonWolfehaus
vonWolfehaus / typescript.sublime-build
Created December 10, 2012 02:32
TypeScript build system
{
"cmd": ["tsc", "--target", "ES5", "$file"],
"file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
"selector": "source.ts",
"shell": true,
"windows": {
"cmd": ["tsc.exe", "$file"]
},
"osx": {
"path": "/usr/local/bin:/opt/local/bin"
@vonWolfehaus
vonWolfehaus / .eslintrc
Created November 19, 2015 19:57
Personal ESlint ruleset
{
"root": true,
"extends": "eslint:recommended",
"ecmaFeatures": {
"arrowFunctions": true,
},
"plugins": ["riot"],
"globals": {
"riot": true,
"moment": true
@vonWolfehaus
vonWolfehaus / Comments.tmPreferences
Created January 20, 2013 07:11
Add toggle comment command support for TypeScript
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.ts</string>
<key>settings</key>
<dict>
@vonWolfehaus
vonWolfehaus / sineHill.js
Created February 2, 2013 03:49
Create a sine-based "hill" with configurable parameters.
var ctx = canvas.getContext('2d');
var iterations = 15,
moveX = 10,
amp = 80,
startX = 200, startY = 200,
i, rad, ny;
ctx.beginPath();
ctx.moveTo(startX, startY);