Skip to content

Instantly share code, notes, and snippets.

@kenany
kenany / sha-rename.py
Created October 22, 2011 02:19
Renames files based on their SHA1 hash. Meant for images.
#!/usr/bin/env python
'''
USE AT YOUR OWN RISK!
This script occasionally corrupts my files, this might be an error in the renaming process.
I only use this script for a bunch of meaningless photos that I don't mind losing.
You have been warned!
'''
__author__ = "Kenan Yildirim"
@kenany
kenany / style.css
Created March 11, 2012 18:21
My MarkdownPad Styles
/*
* MarkdownPad (http://markdownpad.com) let's you customize its output styles
*
* This is the current style I use.
*
* HEAVILY based off the style of hashify.me: https://bitbucket.org/davidchambers/hashify.me/src/737c822316e7/hashify.css
*/
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
@kenany
kenany / Gemfile
Created April 4, 2012 00:09
eventmachine error on Windows
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Extention libraries
gem 'thin', '~> 1'
# Rendering engines and vendor libraries
gem 'jquery-rails', '2.0.0'
gem 'rdiscount'
@kenany
kenany / base64_final.js
Created April 10, 2012 20:38
base64 in JavaScript
function utf8_to_b64( str ) {
return window.btoa(unescape(encodeURIComponent( str )));
}
function b64_to_utf8( str ) {
return decodeURIComponent(escape(window.atob( str )));
}
Modernizr.load({
test: window.btoa && window.atob,
@ECHO OFF
SET "PYTHONPATH=.;C:\Program Files (x86)\Sublime Text 2;C:\Program Files (x86)\Sublime Text 2\python26;"
start /B sublime_text.exe %*
exit
SETLOCAL ENABLEEXTENSIONS
:v64_path_a2
For /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Wow6432Node\Bohemia Interactive Studio\ArmA 2" /v "MAIN"') Do (set _ARMA2PATH=%%B)
IF NOT DEFINED _ARMA2PATH (GOTO v32_path_a2) ELSE (GOTO v64_path_a2oa)
:v32_path_a2
For /F "Tokens=2* skip=2" %%C In ('REG QUERY "HKLM\SOFTWARE\Bohemia Interactive Studio\ArmA 2" /v "MAIN"') Do (set _ARMA2PATH=%%D)
@kenany
kenany / swiftype.coffee
Created September 6, 2012 23:41
Swiftype snippet in CoffeeScript
# Swiftype relies on the creation of the global variable window.Swiftype.
# Due to CoffeeScript's top-level function safety wrapper, the snippet requires
# modification in order to make the Swiftype variable break free of lexical
# scope hell.
# I would love some feedback on whether the existential operator is a better
# choice than simply using `or`
Swiftype = window.Swiftype ? {}
@kenany
kenany / sublime.json
Last active October 10, 2015 11:48
Sublime Text preferences
{
"close_windows_when_empty": false,
"default_line_ending": "unix",
"find_selected_text": true,
"folder_exclude_patterns":
[
".git"
],
"font_face": "Source Code Pro",
"font_options":
@kenany
kenany / herp.coffee
Created September 11, 2012 00:32
Herp Derp YouTube Comments (CoffeeScript edition)
# labs.tannr.com/projects/herpderp/herp.js
randomDerp = ->
@derpOriginal = $(@).html()
$(@).click ->
$(@).html @derpOriginal
randomLength = Math.floor(Math.random() * 20) + 1
wordArray = new Array
@kenany
kenany / epicmafia.js
Created October 1, 2012 23:03
EpicMafia JavaScript snippets
/**
* Fakes a quote by a person. Only works during the day.
*
* `msg` is the message that'll be shown as quoted
* `target` is the player you want to fake-quote
*/
window.orbit.sendcmd('<', {
'msg': 'Message',
'quote': true,
'target': 'kenan',