Skip to content

Instantly share code, notes, and snippets.

@-moz-document url("chrome://xqjs/content/xqjs.xul") {
#code{
font-size: 11pt !important;
font-family: "DejaVu+IPAG" !important;
}
}
/* Run this from your error console. WARNING: removes tabs from their existing groups! */
var Cc = Components.classes;
var Ci = Components.interfaces;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var winEnum = wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
var win = winEnum.getNext();
win.TabView._initFrame(function() {
var contentWindow = win.TabView._window;
contentWindow.UI.reset();
@ba3r
ba3r / universalsubs.js
Created December 9, 2010 19:48
subtitle any video using universalsubtitles.org
/* Universal Subtitles v0.72a */
CmdUtils.CreateCommand({
names: ["subtitle"],
description: "Add subtitles to any web video using open standards.",
help: "Open a video or select an URL and type subtitle",
author: {
name: "Michael Baer",
homepage: "http://twitter.com/shaytards",
},
license: "GPL",
@paulp
paulp / x.js
Created January 31, 2011 20:03 — forked from tssm0n/x.js
CmdUtils.CreateCommand({
names: ["java"],
arguments: [{role: "object",
nountype: noun_arb_text,
label: "search criteria"}],
icon: "http://www.sun.com/favicon.ico",
preview: "Searches The Java 6 API.",
help: "Enter the name of the Java class or package for which you would like to see the documentation.",
author: {name: "KS", email: "tss@cornbread.com"},
@xulapp
xulapp / Bug330458.uc.js
Created April 3, 2011 14:05
document.loadOverlay
// ==uc==
// @include *
// @exclude chrome://browser/content/preferences/preferences.xul
// ==/uc==
(function Bug330458() {
var orgLoadOverlay = document.loadOverlay;
var queue = [];
var loading = false;
// Coffee Script compiler wrapper for WSH JScript (must be placed in the same directory as coffee-script.js)
// Usage: cscript coffee-maker.js [--watch] file
// inspired by http://kennyj-jp.blogspot.com/2011/01/coffeescriptwindows.html
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName.slice(
0, -WScript.ScriptName.length);
eval(fs.OpenTextFile(scriptPath + "coffee-script.js", 1).ReadAll());
function compileFile(file) {
@thejh
thejh / bot.coffee
Created August 14, 2011 21:38
My IRC bot, jhbot
coffee = require 'coffee-script'
https = require 'https'
npm = require 'npm'
Irc = require 'irc-js'
cradle = require 'cradle'
{GitHubApi} = require 'github'
request = require 'request'
gitHubApi = new GitHubApi()
githubIssueApi = gitHubApi.getIssueApi()
githubObjectApi = gitHubApi.getObjectApi()
@shesek
shesek / gist:1444629
Created December 7, 2011 21:00
CS stuff
_ = require 'underscore'
{Assign, Value, Literal, Access, Block, Class, Op, Obj, Arr, For, Index, Call, Return, If, Throw} = nodes = require '../nodes'
exports.originals = originals = {}
exports.codeblock = codeblock = (block) ->
return block unless block?
if typeof block is 'function'
@blendmaster
blendmaster / gist:1897787
Created February 24, 2012 04:41
.hack assembler main logic in coco
code = input
.replace /\/\/.*/gm '' # remove comments
.trim!
.split /\s+/ # turn into lines
.filter (it, i) -> # build symbol table and remove labels
if it.match /\(([A-Za-z\._$:][\w\.$:]*)\)$/ # that[1] is the first capturing group
symbols[that[1]] = i - len++ # len++ adjusts the symbol's line number to the filtered array
return false
true # keep actual instructions
.map -> # parse instructions
@liaody
liaody / coffeescript_gotcha.md
Created January 12, 2012 01:56
Coffeescript gotchas when migrating from javascript

Here are some of the "gotchas" I've encountered when I converted all the javascript code into coffeescript. (BTW, this is gathered while coding for YourMechanic.com, a very cool mobile auto repair service.)

Disclaimer: Coffeescript is a great productivity booster for me personally. Even with all the things outlined below, it is still way better than javascript. None of these should discourage you from jumping into it right away.

Major gotchas

(Things that generate wrong code silently)