Skip to content

Instantly share code, notes, and snippets.

View iamdustan's full-sized avatar

Dustan Kasten iamdustan

View GitHub Profile
@iamdustan
iamdustan / ui.js
Created July 17, 2014 13:22
Added mousewheel support for Zynga Scroller. Replace ui.js in the demo with this to see it in action. https://github.com/zynga/scroller/blob/master/demo/asset/ui.js
// Intialize layout
'use strict';
var container = document.getElementById("container");
var content = document.getElementById("content");
var clientWidth = 0;
var clientHeight = 0;
// Initialize Scroller
this.scroller = new Scroller(render, {
layout title tags summary
post
Breaking Development 2014. Nashville Edition.
conference

Breaking Development Nashville ended mere hours ago. Gene Crawford and the team at Unmatched Style

// TODO: in straight type-ahead mode (showResults: false), if noMatchingResults, dropdown appears after new match
// TODO: consider having options.mode (select, which replaces html select; combobox; suggest; others?)
// TODO: on resize (at least when wrapping within a table), the arrow is pushed down to the next line
// TODO: check for boundary/value problems (such as minChars of -1) and alert them
// TODO: add options for advanced paging template
// TODO: general cleanup and refactoring, commenting
// TODO: detailed Exception handling, logging
// TODO: FF2, up arrow from bottom has erratic scroll behavior (if multiple flexboxes on page)
// TODO: FF2 (and maybe IE7): if maxVisibleRows == number of returned rows, height is a bit off (maybe set to auto?)
// TODO: escape key only works from input box (this might be okay)
@iamdustan
iamdustan / simple-sorting.clj
Created September 2, 2014 02:06
codeeval simple-sorting
(ns worky
(:gen-class)
(:use clojure.pprint))
(defn process [line]
(if (not= "" line)
(sort (vec (map read-string (re-seq #"-?[\d.]+" line))))))
(defn fmt [line]
javascript: (function(){function getPropertyDescriptors(object){var props={};for(var prop in object){props[prop]={type:typeof object[prop],value:object[prop]}} return props;} function getCleanWindow(){var elIframe=document.createElement('iframe');elIframe.style.display='none';document.body.appendChild(elIframe);elIframe.src='about:blank';return elIframe.contentWindow;} function appendControl(el,name){var elCheckbox=document.createElement('input');elCheckbox.type='checkbox';elCheckbox.checked=true;elCheckbox.id='__'+name;var elLabel=document.createElement('label');elLabel.htmlFor='__'+name;elLabel.innerHTML='Exclude '+name+' properties?';elLabel.style.marginLeft='0.5em';var elWrapper=document.createElement('p');elWrapper.style.marginBottom='0.5em';elWrapper.appendChild(elCheckbox);elWrapper.appendChild(elLabel);el.appendChild(elWrapper);} function appendAnalyze(el){var elAnalyze=document.createElement('button');elAnalyze.id='__analyze';elAnalyze.innerHTML='Analyze';elAnalyze.style.marginTop='1em';el.appendChil
# generate a list of AUTHORS
# common usage: `git authors > AUTHORS`
# Thanks to @chrisjkirkhamon on http://www.commandlinefu.com/commands/by/chrisjkirkham
git log --format='%aN <%aE>' | awk '{arr[$0]++} END{for (i in arr){print arr[i], i;}}' | sort -rn | cut -d\ -f2-
/** @jsx React.DOM */
var React = require('react');
var ReactStyle = require('react-style');
var inputStyles = ReactStyle({
background: '#fff',
border: '1px solid #ccc',
paddingRight: '1rem',
position: 'relative',
var fs = require('fs');
var stream = fs.createReadStream(process.argv[2].toString());
var offset = 0;
stream.on('data', function (buf) {
//var buf = process.stdin.read();
if (!buf) return;
for (; offset < buf.length; offset++) {
if (buf[offset] === 0x0a) {
/** @jsx React.DOM */
var React = require('react/addons');
module.exports = React.createClass({
displayName: 'ClearableInput',
doClear() {
// reset input.value
var node = this.refs.input.getDOMNode();
<!doctype>
<html>
<head>
<meta charset="utf8">
<title>Copy-paste overflow</title>
<meta name="viewport" content="width=device-width">
<style>
body {
background: #e0e0e0;
}