This file contains 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
{ | |
"selector": "source.php", | |
"cmd": ["php", "-l", "$file"], | |
"variants": [ | |
{ | |
"name": "Run", | |
"cmd": ["php", "$file"] | |
}, |
This file contains 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
# -*- coding: utf-8 -*- | |
# | |
# Copyright(c) 2015 http://feilong.me | |
# | |
# @author: Felinx Lee <felinx.lee@gmail.com> | |
# | |
from tornado.httpclient import HTTPClient, HTTPRequest | |
from tornado import escape | |
import hashlib |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# zipdb.py | |
# Use a zipfile store a dict like k-v database. | |
# Known bug: duplicate key(filenames) allowed | |
# | |
# Copyright 2012 mayli <mayli.he@gmail.com> | |
# |
This file contains 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
def cartesian (lists): | |
if lists == []: return [()] | |
return [x + (y,) for x in cartesian(lists[:-1]) for y in lists[-1]] | |
print cartesian([[1, 2, 3], [2, 4, 6], [3, 6, 9]]) |
This file contains 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
# Remove non-alphabetic characters (hyphens, etc) from the word. | |
def strip_non_alpha(word): | |
return "".join([x for x in list(word.lower()) if (x >= 'a' and x <= 'z')]) | |
# Sort the letters in the word (in reverse). | |
def sort_letters(word): | |
letters = sorted(list(word)) | |
letters.reverse() | |
return "".join(letters) |
This file contains 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
def grid_search(features, results): | |
gamma_values = [(2 ** n) for n in range(-15, 4)] | |
cost_values = [(2 ** n) for n in range(-5, 16)] | |
params_values = [(gamma, cost) for gamma in gamma_values | |
for cost in cost_values] | |
best_auc = 0 | |
best_gamma = None | |
best_cost = None |
This file contains 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
// Cartesian product of arrays | |
// @takes N arrays -- arguments *must* be arrays | |
// @returns an array of X arrays of N elements, X being the product of the input arrays' lengths. | |
function cartesianProduct(...arrays) { | |
function _inner(...args) { | |
if (arguments.length > 1) { | |
let arr2 = args.pop(); // arr of arrs of elems | |
let arr1 = args.pop(); // arr of elems | |
return _inner(...args, |
This file contains 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 cartesianProductOf() { | |
return _.reduce(arguments, function(a, b) { | |
return _.flatten(_.map(a, function(x) { | |
return _.map(b, function(y) { | |
return x.concat([y]); | |
}); | |
}), true); | |
}, [ [] ]); | |
}; |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
This file contains 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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Data> | |
<Series> | |
<id>83462</id> | |
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors> | |
<Airs_DayOfWeek>Monday</Airs_DayOfWeek> | |
<Airs_Time>10:00 PM</Airs_Time> | |
<ContentRating>TV-PG</ContentRating> | |
<FirstAired>2009-03-09</FirstAired> | |
<Genre>|Drama|</Genre> |
OlderNewer