git clone git://gist.github.com/923934.git redisearch
cd redisearch
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
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
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 crc32(s/*, polynomial = 0x04C11DB7, initialValue = 0xFFFFFFFF, finalXORValue = 0xFFFFFFFF*/) { | |
s = String(s); | |
var polynomial = arguments.length < 2 ? 0x04C11DB7 : (arguments[1] >>> 0); | |
var initialValue = arguments.length < 3 ? 0xFFFFFFFF : (arguments[2] >>> 0); | |
var finalXORValue = arguments.length < 4 ? 0xFFFFFFFF : (arguments[3] >>> 0); | |
var table = new Array(256); | |
var reverse = function (x, n) { | |
var b = 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
import org.apache.commons.codec.binary.Base64.decodeBase64 | |
import play.api._ | |
import play.api.mvc._ | |
trait BasicRealm { | |
def name: String | |
def authorize(user: String, password: String): Boolean | |
} | |
object BasicRealm extends Controller { |
JavaScript Code
var str = "hi";
Memory allocation:
Address | Value | Description |
---|---|---|
...... |
... |
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
/** | |
Usage example: | |
var redisConfig = { | |
masterName: "mymaster", | |
sentinels: [ | |
{host: "127.0.0.1", port: 26384}, | |
{host: "127.0.0.1", port: 26383}, | |
{host: "127.0.0.1", port: 26382} | |
], | |
}; |
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
// XXX should be standard (and named clone, after Java?) | |
Object.prototype.copy = function () { | |
let o = {} | |
for (let i in this) | |
o[i] = this[i] | |
return o | |
} | |
// Containment testing for arrays and strings that should be coherent with their iterator. | |
Array.prototype.contains = String.prototype.contains = function (e) { |
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
// Generate a mixin for mobile full width columns, to maintain the same attributes | |
.make-column(@gutter: @grid-gutter-width) { | |
position: relative; | |
// Prevent columns from collapsing when empty | |
min-height: 1px; | |
// Inner gutter via padding | |
padding-left: (@gutter / 2); | |
padding-right: (@gutter / 2); | |
} |
http://ruby-china.org/topics/16256
get https://github.com/mvj3/hangman/blob/master/data/words.txt
and compile the decision tree.json
ruby compile.rb
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
/** | |
* POST to create a new user. | |
*/ | |
exports.create = function *(){ | |
var body = yield parse(this); | |
// password | |
var pass = body.password; | |
assert(pass, 400, 'password is required'); |
OlderNewer