Skip to content

Instantly share code, notes, and snippets.

@heyalexchoi
heyalexchoi / actionBlocker.js
Last active September 26, 2020 06:05
protect the user
var scr = document.createElement("script");
scr.src = "https://code.jquery.com/jquery-3.5.1.slim.min.js";
document.body.appendChild(scr);
$(document.body).click(function(event){
event.preventDefault();
alert("i'm sorry but you can't do that. better luck next time")
});
@heyalexchoi
heyalexchoi / copy_redis.py
Last active April 3, 2020 03:25
copy redis
# there are a few different ways to copy data from one redis instance to another
# from what i've read, you can set up your new instance as a slave to the old
# and let redis replication do its thing
# or, it seems you can copy the underlying dump data from one instance's file system to the other's
# however, sometimes you don't manage your own redis instances, or maybe you just don't want to bother
# with any of that. you could just copy the data.
# this script does that.
# there were some other scripts online already
# - https://github.com/jeremyfa/node-redis-dump
# - https://github.com/yaauie/redis-copy
@heyalexchoi
heyalexchoi / Benchmarker.swift
Created October 14, 2016 15:59
swift benchmarker
/*! accepts event names and prints out time interval (seconds) since last event given */
struct Benchmarker {
struct Event {
let time: NSDate
let name: String
}
static var events = [Event]()
static let prefix = "--------\n--------\n--------\nBENCHMARK\n--------\n--------\n--------\n"