Skip to content

Instantly share code, notes, and snippets.

@rajnathani
rajnathani / iftrue.py
Last active December 26, 2015 22:59
essential script i hacked upon to make my prototyping workflow possible
import re,sys
WANT_OPENING_BRACE = 10
WANT_CLOSING_BRACE = 12
def find_if_block(string_input, cur_index):
remaining_input = string_input[cur_index:]
if_true_indices = [(m.start(0), m.end(0)) for m in re.finditer(r'if\s*\(\s*true\s*\)\s*\{', remaining_input)]
if if_true_indices:
@rajnathani
rajnathani / core.js
Last active December 24, 2015 20:59
layer about jquery ajax calls
function go_ajax(url, method, data, success_func, extra_dict) {
if ($.type(data) === "function") {
var success_func_holder = success_func;
success_func = data;
extra_dict = success_func_holder;
data = undefined;
}
$.ajax({
url: url,
type: method,