Skip to content

Instantly share code, notes, and snippets.

// With little creativity and some coding skills you can do a lot of things using this code to annoy some one.
// works on the first chat box opened. only works in google chrome!
function dispatch(target) {
var evt = document.createEvent("Event");
evt.initEvent("keydown",true,true);
evt.keyCode = 13;
evt.which = 13;
target.dispatchEvent(evt);
}
//Works on http://web.whatsapp.com
// With little creativity and some coding skills you can do a lot of things using this code to annoy some one.
function dispatch(target, eventType, char) {
var evt = document.createEvent("TextEvent");
evt.initTextEvent (eventType, true, true, window, char, 0, "en-US");
target.focus();
target.dispatchEvent(evt);
}
function triggerClick() {
var event = new MouseEvent('click', {
@philfreo
philfreo / gist:7257723
Created October 31, 2013 21:44
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@nodesocket
nodesocket / bootstrap.flatten.css
Last active April 1, 2021 23:37
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;

Self-Hosting in SpiderMonkey

Firefox has always contained large amounts of JavaScript in the application itself, and with each release, that amount usually grows. Some of the JS code that is contained in Firefox 21, released last Tuesday, is special, however: it forms part of SpiderMonkey itself, the virtual machine that runs all JS code in Firefox and on websites loaded into the browser.

Implementing parts or the whole of a runtime or compilation environment for a language in that very language itself is called self-hosting, and it isn't a new invention by any means. Examples of languages with (partly) self-hosted compilers include C/C++, Pascal and Rust. Partially self-hosted VMs exist, among others, for Lisps of all ages, Python, Ruby, Java, .Net, ActionScript3 - and JS. In fact, the V8 VM that executes JS in Chromium and Node.js has been partially self-hosted for a number of years now (maybe even from the outset, I don't know).

Why?

Various reasons. Code that is implemented in managed, memory-saf

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ngsankha
ngsankha / README.md
Created June 2, 2012 09:08
Creates an archive of tweets as a git repo

This Python script creates a git repo with your tweets. Obviously its limited by Twitter API limitations as you cannot retrieve more than 3200 tweets at a time.

Given the fact that Twitter doesn't give a fuck about our data, you may not find your old tweets ever again. So nothing is better than keeping an archive of tweets as a Git repo.

This is inspired by @holman's tweets repo. But this doesn't have a dependency on Madrox. Just plain Python and Git.

Usage

To create an archive of tweets initiate a git repo in a directory with git init. Then put the script in the directory and execute: