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(value) { | |
// First we need to find which quote character to use by comparing the | |
// number of times each occurs in the string. | |
var quotes_dbl = (value.match(/"/g) || []).length; | |
var quotes_sgl = (value.match(/'/g) || []).length; | |
var quote = quotes_sgl <= quotes_dbl ? "'" : '"'; | |
var quote_code = quote.charCodeAt(0); | |
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
suit.TextLayout = function SUITTextLayout() { | |
suit.Object.call(this); | |
/* This stores key/value pairs where the key is the width of a rendered | |
layout and the value is the number of lines the layout will take. */ | |
this.wrapped_length_cache = []; | |
this.em_width = this.text_width("M"); | |
}; |
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
var fs = require('fs'); | |
var repl = require('repl'); | |
console.log("Loading dictionary..."); | |
var words = fs.readFileSync("/usr/share/dict/american-english-small", "ascii"); | |
var wordlist = {}; | |
var regex = /[a-z]{4,}/g; | |
var match; |
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
"use strict"; | |
// http://kickjava.com/src/java/math/MutableBigInteger.java.htm | |
String.prototype.repeat = function(i) { | |
var d = '', t = this; | |
while (i) { | |
if (i & 1) { | |
d += t; | |
} |
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
var Complex = function(real, imag) { | |
if (!(this instanceof Complex)) { | |
return new Complex (real, imag); | |
} | |
if (typeof real === "string" && imag == null) { | |
return Complex.parse (real); | |
} | |
this.real = Number(real) || 0; |
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
1. Map characters to source character set (not relevant) | |
2. Trigraph sequences replaced (no one cares, low priority) | |
3. Backslash followed by newline deleted | |
4. Decomposed into tokens | |
5. Preprocessing directives executed | |
6. Macros expanded | |
7. _Pragma execution |
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
// Example 1 | |
function pyth(x, y) { | |
return Math.sqrt (x*x + y*y); | |
} | |
// Example 2 | |
function factorial(n) { | |
if (n === 0) { | |
return 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
/* Connection#send: Sends a message with flood control */ | |
Connection.prototype.send = function(message) { | |
var queue, now; | |
now = Date.now(); | |
queue = this.message_queue; | |
/* If the last message was sent early enough... */ | |
if (this.message_time < (now - this.message_speed)) { |
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
Hub.init = function() { | |
this.load_config (function() { | |
this.start_server (); | |
}); | |
}; | |
Hub.load_config = function(callback) { | |
var config, locations, self = this; | |
config = new HubConfig; |
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
{ | |
"Core": { | |
"socket": "/tmp/diaptoval.sock" | |
}, | |
"IRC": { | |
"default": { | |
"nick": ["eboy", "eboyjr", "eboyjr_"], | |
"quit_message": "Try out lic, the IRC client, for free at http://github.com/oftn/lic/" | |
}, | |
"servers": [ |
OlderNewer