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
// Intallation: | |
// npm install jsdom jquery | |
var jsdom = require('jsdom'); | |
jsdom.env('http://google.ca/', null, function (err, window) { | |
$ = require('jquery').create(window); | |
$('a').each(function () { | |
console.log($(this).attr('href'), ' ---> ', $(this).text()); | |
}); |
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
// Remove the current playlist | |
var files = turntable.playlist.files; | |
var arr = []; | |
for (var i=0, len=files.length; i<len; i++) { | |
arr.push(files[i].fileId); | |
} | |
function remRec(arr) { | |
var fileId = arr.splice(0, 1)[0]; | |
turntable.playlist.removeFile(fileId); | |
if (arr.length > 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
var http = require('http') | |
, fs = require('fs') | |
, PORT = process.argv[2] || 8080 | |
, HOST = process.argv[3] || '127.0.0.1'; | |
http.createServer(function (req, res) { | |
if (req.url == '/events') { | |
res.writeHead(200, { 'Content-Type' : 'text/event-stream' | |
, 'Cache-Control' : 'no-cache' |
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 urllib2, urllib, re, sys | |
def main(): | |
if not len(sys.argv) > 1: | |
print "You shall give a genre. example: python band.py house" | |
return | |
keyword = sys.argv[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
v = {'A': list('CDFIKEGJLPQHMRSNU'), | |
'B': list('CEHNUDGMTFJRILKPO'), | |
'C': list('ABDFIKOEHNU'), | |
'D': list('ACBFIKOGMS'), | |
'E': list('ACBHNUGJLP'), | |
'F': list('AJROKIDCB'), | |
'G': list('ADMSPLJEB'), | |
'H': list('ACENUBMR'), | |
'I': list('ALQOKFDCB'), | |
'J': list('AFRPLGEB'), |
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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
label { display: block; width: 70px; float: left; border-right: 1px solid #187215; padding: 5px; } | |
.box { color: #187215; clear: both; border: 1px solid #187215; margin: 5px; background-color: #e9ffe8; } | |
.cross { width: 30px; height="30px"; display: block; background-color: #f6fff6; text-align: center; float: left; padding: 5px; } | |
.ctrl { margin: 20px; } | |
.left { float: left; } | |
.clear { clear: both; } |
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
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<canvas id="canvas" width="800" height="600"></canvas> | |
<script type="text/javascript"> | |
var ctx = document.getElementById('canvas').getContext('2d') |
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
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<canvas id="canvas" width="800" height="600"></canvas> | |
<script type="text/javascript"> | |
var ctx = document.getElementById('canvas').getContext('2d') |
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
# http://www.quora.com/Puzzle-and-Trick-Questions/How-many-squares-are-in-this-picture | |
def get_square_count(length): | |
squares = 0 | |
nb_nodes = length ** 2 | |
for i in range(nb_nodes): | |
tmp = i + 1 | |
while tmp % 5 != 0 and tmp + ((tmp - i) * length) < nb_nodes: | |
tmp += 1 | |
squares += 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
#! /usr/bin/python | |
# INSTALLATION: | |
# pip install requests | |
# pip install beautifulsoup4 | |
from bs4 import BeautifulSoup | |
import os | |
import requests |
OlderNewer