This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reg(i) return memory.getregister("r"..i) end | |
read8 = memory.readbyte | |
read32 = memory.readdword | |
read16 = memory.readword | |
function read16_noalign(addr) | |
return bit.bor(read8(addr), bit.lshift(read8(addr+1), 8)) | |
end | |
function read32_noalign(addr) | |
return bit.bor(read16_noalign(addr), bit.lshift(read16_noalign(addr+2), 16)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The `quickEach` method will pass a non-unique jQuery instance | |
// to the callback meaning that there will be no need to instantiate | |
// a fresh jQuery instance on each iteration. Most of the slow-down | |
// inherent in jQuery's native iterator method (`each`) is the constant | |
// need to have access to jQuery's methods, and so most developers | |
// see constructing multiple instances as no issue... E.g. | |
// $(...).each(function(){ $(this)... $(this)... $(this)... }); | |
// A better approach would be `quickEach`. | |
jQuery.fn.quickEach = (function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Mysql wrapper, to handle some mysql_* functions in a OOP way. | |
* | |
*/ | |
class App_Db_Mysql { | |
const DEFAULT_ROW_COUNT = 10; | |
const DEFAULT_PAGE = 1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
if (!('nicovideo_getFlv' in window)) { | |
const Getter = function(videoID) { | |
this._videoID = videoID; | |
this._callbacks = []; | |
}; | |
Getter.prototype = { | |
_videoID: null, | |
_lock: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/omniauth.rb | |
module OmniAuth | |
module Strategies | |
# tell OmniAuth to load our strategy | |
autoload :Pixelation, 'lib/pixelation_strategy' | |
end | |
end | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :twitter, "app_name", "secret" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Annoying.js - How to be an asshole to your users | |
* | |
* DO NOT EVER, EVER USE THIS. | |
* | |
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com) | |
* Visit https://gist.github.com/767982 for more information and changelogs. | |
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog | |
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# $ cat spec/spec.opts | |
# --require ~/lib/supermario_progress_bar_formatter.rb | |
# --format Spec::Runner::Formatter::SuperMarioProgressBarFormatter | |
require 'spec/runner/formatter/base_text_formatter' | |
require 'spec/runner/formatter/no_op_method_missing' | |
module Spec::Runner::Formatter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javascript Obfuscation, Minification and why it doesn't really matter. | |
I'm working on placing some geocaches[http://www.geocaching.com] and they must be 0.1 miles away from other geocaches. Being a programmer I thought, well, let's just write a bookmarklet to augment the geocaching website with a radius around the caches displayed on the map. So I googled for chunk of code that would do this because I'm lazy. The first tool was http://www.freemaptools.com/radius-around-point.htm and its UI was clunky but the output looked good enough to me. So I dig into the source... and *gasp* what is this? | |
10111010001000010111010000111101010101101101110100010101010100100001... | |
http://www.freemaptools.com/script/radius-around-point.js | |
At that point, I could've just looked for the next site but I have a few tricks up my sleeve since I've had to dig into ridiculous javascript for serveral of my jobs... The first trick is just use chrome developer tools, it'll probably get you 90% of the way there... and look, it does! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LZW-compress a string | |
function lzw_encode(s) { | |
var dict = {}; | |
var data = (s + "").split(""); | |
var out = []; | |
var currChar; | |
var phrase = data[0]; | |
var code = 256; | |
for (var i=1; i<data.length; i++) { | |
currChar=data[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This plugin will deploy your app using capistrano. | |
# If the build fails the app won't de be deployed and if it passes it will try to deploy to a list of stages you can supply. | |
# | |
# Configuration | |
# In your project's cruise_config.rb file: | |
# | |
# Pass an array of stages you want to deploy to | |
# project.cap_deployer.stages = ['integration', 'staging'] | |
# | |
# source ~/.rvm/scripts/rvm before deployment? |