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
package main | |
import ( | |
"strings" | |
"code.google.com/p/go-tour/wc" | |
) | |
func WordCount(s string) map[string]int { | |
m := make(map[string]int); | |
for _, vv := range strings.Fields(s) { |
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
'use strict'; | |
var onlineStatusApp = angular.module('onlineStatusApp', []); | |
onlineStatusApp.factory('onlineStatus', ["$window", "$rootScope", function ($window, $rootScope) { | |
var onlineStatus = {}; | |
onlineStatus.onLine = $window.navigator.onLine; | |
onlineStatus.isOnline = function() { |
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
angular.module('appApp') | |
.directive('datePicker', function ($timeout) { | |
return { | |
restrict: 'E', | |
replace: true, | |
scope: { ngModel: '=' }, | |
template: | |
'<div class="controls">' + | |
'<select class="span2">' + | |
'</select> / ' + |
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
import os | |
localDir = os.path.dirname(__file__) | |
absDir = os.path.join(os.getcwd(), localDir) | |
import cherrypy | |
class FileDemo(object): | |
def index(self, myFile=None, derp_cv=None, **kwargs): | |
if cherrypy.request.method == "POST": |
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
#!/bin/sh | |
sudo apt-get update | |
sudo apt-get install openjdk-6-jre | |
sudo apt-get install openjdk-6-jdk | |
sudo wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - | |
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' | |
sudo apt-get update | |
sudo apt-get install jenkins | |
sudo apt-get install ant |
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
from threading import Thread | |
import cProfile | |
import pstats | |
def enable_thread_profiling(): | |
'''Monkey-patch Thread.run to enable global profiling. | |
Each thread creates a local profiler; statistics are pooled | |
to the global stats object on run completion.''' |
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
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida, nisl consectetur dignissim euismod, ante tortor rutrum libero, ac euismod mauris elit non augue. Morbi vel placerat mi. In enim metus, commodo nec adipiscing eget, vestibulum ut turpis. In lacinia justo sit amet erat tristique in pharetra nisl condimentum. Vivamus at diam ac nibh placerat egestas id sit amet velit. Mauris sed enim eu metus congue hendrerit. Duis sem nibh, rutrum venenatis pretium eget, auctor sit amet odio. Vivamus nisl ligula, interdum vitae scelerisque et, feugiat quis ipsum. Morbi vel dolor ut nunc pharetra placerat. Pellentesque id quam lacus, ut placerat purus. |
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 timeit(fn): | |
def time_fn(*arg, **kw): | |
import time | |
now = time.time() | |
fn(*arg, **kw) | |
total = time.time() - now | |
print "total time for %s: %d" % (fn.__name__, total) | |
return time_fn |
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 getScrollBarDimensions() { | |
var elm = document.documentElement.offsetHeight ? document.documentElement : document.body, | |
curX = elm.clientWidth, | |
curY = elm.clientHeight, | |
hasScrollX = elm.scrollWidth > curX, | |
hasScrollY = elm.scrollHeight > curY, | |
prev = elm.style.overflow, | |
r = { vertical: 0, horizontal: 0 }; | |
if ( !hasScrollY && !hasScrollX ) |