Skip to content

Instantly share code, notes, and snippets.

@dannygarcia
dannygarcia / example.markdown
Created February 9, 2012 18:32
Normalizing Mouse Coordinates

Normalizing Input Coordinates

Constants

x = Input X or Y Position
w = Context X or Y Width

Left-to-right

0 ==========0.5========== +1

.item {
width: 560px;
}
header {
width: 250px;
float: right;
}
.bid-stack {
@dannygarcia
dannygarcia / makefile
Created July 19, 2012 16:42
make amd files
# required ?
npm install r.js -g
r.js -o name=example/site out=build/site.build.js optimize=none baseUrl=.
@dannygarcia
dannygarcia / crawler.js
Created August 12, 2012 06:01
GitHub Repo File Structure Crawler
var ajax = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
xhr.onreadystatechange = function (e) {
if (e.target.status === 200 && e.target.readyState === 4) {
callback(JSON.parse(e.target.response));
}
};
};
@dannygarcia
dannygarcia / .tmux.conf
Created August 13, 2012 23:26 — forked from napcs/.tmux.clipboard
My tmux config
# remap prefix to Ctrl-a instead of Ctrl-b
unbind C-b
set -g prefix C-a
# Allow C-A a to send C-A to application. Useful for Vim, other apps
bind C-a send-prefix
# Reload the .tmux.conf file with Ctrl-r
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
@dannygarcia
dannygarcia / test.js
Created September 17, 2012 01:32
test js syntax highlight
// Simple ajax function to avoid using jQuery (°-°)
var ajax = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
xhr.onreadystatechange = function (e) {
if (e.target.status === 200 && e.target.readyState === 4) {
callback(e.target.response);
}
};
@dannygarcia
dannygarcia / grunt.js
Created September 20, 2012 02:39
Sample grunt-jekyll grunt.js
// Sample grunt-jekyll grunt.js file
// https://github.com/dannygarcia/grunt-jekyll
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jekyll: {
@dannygarcia
dannygarcia / Home.js
Created November 11, 2012 08:22
Transitional Module
define(
[
"./Page",
"../modules/Transitional",
"$"
],
function (Page, Transitional, $) {

Overview

  1. Quick Find
  2. Quick Union

Steps to developing a useful algorithm.

  1. Model the problem.
  2. Find an algorithm to solve it.
  3. Fast enough? Fits in memory?
  4. If not, figure out why.
<snippet>
<content><![CDATA[
console.log(${0:msg});
]]></content>
<tabTrigger>cl</tabTrigger>
<scope>source.js</scope>
<description>console.log</description>
</snippet>