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 urllib | |
import urllib2 | |
import json | |
import pprint | |
import codecs | |
import sqlite3 | |
import sys | |
import logging | |
import time |
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
define([], function () { | |
var helpers; | |
var Expandable = new Class; | |
Expandable.include({ | |
init : function (element) { | |
this.el = element; | |
this.parentList = helpers.getParentList(this.el); | |
this.menu = helpers.getMenu(this.el); | |
this.exclusive = true; |
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
<script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
google.load('visualization', '1', {packages: ['corechart']}); | |
</script> | |
<script type="text/javascript"> | |
function drawVisualization() { | |
// Create and populate the data table. | |
var data = new google.visualization.DataTable(); | |
var raw_data = [ |
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
// intialization section | |
grammar CSS21; | |
options | |
{ | |
backtrack=true; | |
memoize=true; | |
superClass=DiguaParser; | |
} |
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> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> |
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
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "The script must take two arguments: namenode internal hostname and current machine internal hostname." | |
exit 0 | |
fi | |
# JAVA_HOME is not set by default | |
sudo sh -c "echo 'export JAVA_HOME=/usr/lib/jvm/java-6-openjdk' >> /etc/profile" | |
sudo ln -s /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-openjdk # needed because bigtop-utils do not recognize the prev path | |
source /etc/profile |
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
<pre> | |
<?php | |
define('WP_IMPORT_ADMIN', TRUE); | |
define('TAXONOMY', 'portfolio_category'); | |
require_once( dirname(dirname(__FILE__)) . '/admin.php'); | |
function addThumbnail($url, $name, $post_id) { | |
$filename = "../../wp-content/uploads/thumbnails/" . strtolower(preg_replace('/(\s\s+)|(\s*[^a-zA-Z0-9]+\s*)/', '-', $name)) . ".jpg"; | |
file_put_contents($filename, file_get_contents($url)); |
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 java.util | |
import scala.collection.mutable.ListBuffer | |
object PrimeFactorCalculator { | |
def prime(number: Integer):Boolean = { | |
if (number < 2) return false | |
if (number == 2) return true | |
for (i <- 3 to Math.sqrt(number.toDouble).toInt by 2 if (number % i == 0)) | |
return false | |
true |
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
require 'formula' | |
class ScalaDocs < Formula | |
homepage 'http://www.scala-lang.org/' | |
url 'http://www.scala-lang.org/files/archive/scala-docs-2.9.3.zip' | |
sha1 '633a31ca2eb87ce5b31b4f963bdfd1d4157282ad' | |
end | |
class Scala < Formula | |
homepage 'http://www.scala-lang.org/' |
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
from itertools import groupby | |
from threading import Thread | |
from random import randint | |
from time import sleep | |
# see http://stackoverflow.com/questions/29291270/threading-in-python-processing-multiple-large-files-concurrently | |
for key, partition in groupby(range(1, 50), lambda k: k//10): | |
threads = [] | |
for idx in list(partition): | |
thread_name = 'thread-%d' % idx |
OlderNewer