Skip to content

Instantly share code, notes, and snippets.

@EvanHahn
EvanHahn / detect_rockmelt.js
Created June 7, 2011 23:38
Detect if your browser is RockMelt
function isRockMelt() {
return (navigator.userAgent.indexOf("RockMelt") !== -1)
}
@EvanHahn
EvanHahn / evankod.css
Created August 2, 2011 19:44
Evan Hahn's Kod theme
/*
* Evan Hahn's Kod theme
* Copyright (c) 2011 Evan Hahn
* Free for any use.
*/
/* General stuff */
body {
font-family: "Monaco", monospace;
@EvanHahn
EvanHahn / gist:1135646
Created August 10, 2011 00:33
Choose objects by weight. Free license.
/**
* Choose objects by weight.
* @author Evan Hahn
* @version 1.00
* @param {Object[]} objects An array of objects that each have a "weight" property.
* @param {Number} howMany How many should I choose?
* @returns An array of chosen objects, containing howMany values.
* @example
* chooseByWeight([
* {
@EvanHahn
EvanHahn / gist:1135851
Created August 10, 2011 01:46
Tic Tac Toe in Lua. Free license.
--[[
TIC-TAC-TOE
by Evan Hahn (http://www.evanhahn.com/)
This is a program that allows you to play tic-tac-toe against the
computer.
You may change the configuration (below) to make the board more than 3x3,
or play with "white" and "black" instead of "x" and "o", and change how
@EvanHahn
EvanHahn / euler_method_calculator.cpp
Created August 21, 2011 08:33
Euler Method calculator
/* ***************************
EULER METHOD CALCULATOR
by Evan Hahn (evanhahn.com)
***************************
This will use the Euler method to estimate values of a differential
equation.
Code licensed under a CC-BY 3.0 license:
http://creativecommons.org/licenses/by/3.0/ */
@EvanHahn
EvanHahn / gist:1880482
Created February 22, 2012 01:35
My vimrc
syntax on " syntax highlighting
set sw=4 " shift width
set ul=100 " undo level
set ai " auto indent
set si " smart indent
set ruler " show cursor position
@EvanHahn
EvanHahn / gist:2030416
Created March 13, 2012 18:16
Wolfram|Alpha, restyled
/*
Wolfram|Alpha, restyled
by Evan Hahn,
for URL patterns like: *wolframalpha.com/input*
Made for use with Stylebot for Google Chrome
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
@EvanHahn
EvanHahn / gist:2473233
Created April 23, 2012 19:24
Quickly-made flashcards for Asian 261
<!--
Quickly-made flashcards file, by Evan Hahn (evanhahn.com)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
@EvanHahn
EvanHahn / Unlicense.txt
Created April 30, 2012 19:05
Unlicense backup
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@EvanHahn
EvanHahn / gist:2587465
Last active October 9, 2023 01:26
Caesar shift in JavaScript
/*
JavaScript Caesar shift
by Evan Hahn (evanhahn.com)
"Encrypt" like this:
caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!"
And "decrypt" like this: