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
_avg = (items) -> | |
sum = 0 | |
sum += item for item in items | |
sum / items.length | |
class Benchmark | |
constructor: (@functions,@maxSampling) -> | |
@check() | |
check: () -> |
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
$.widget.bridge = function( name, object ) { | |
var fullName = object.prototype.widgetFullName || name; | |
$.fn[ name ] = function( options ) { | |
var isMethodCall = typeof options === "string", | |
args = slice.call( arguments, 1 ), | |
returnValue = this; | |
// allow multiple hashes to be passed on init | |
options = !isMethodCall && args.length ? | |
$.widget.extend.apply( null, [ options ].concat(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() { | |
function cssAsNum(width){ | |
return Number(width.replace("px","")) | |
} | |
var body,img; | |
body = document.body; | |
img = document.createElement("img"); | |
img.style.userSelect = "none"; | |
img.style.position = "fixed"; | |
img.style.zIndex = 999999; |
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 createObject (clazz, args) { | |
var o; | |
if (Object.create) { | |
o = Object.create(clazz) | |
clazz.constructor.apply(xx, args); | |
} else { | |
// screwed! nothing other than evil-eval :-( | |
o = eval("new " + clazz.constructor.name + "(" + 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="application-custom"> | |
<macrodef name="git" taskname="@{taskname}"> | |
<attribute name="command" /> | |
<attribute name="dir" default="" /> | |
<attribute name="property" default="" /> | |
<attribute name="taskname" default="" /> | |
<attribute name="failonerror" default="on" /> | |
<element name="args" optional="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
#!/usr/local/bin/coffee | |
SEC = 1000 | |
MIN = SEC * 60 | |
HOUR = MIN * 60 | |
DAY = HOUR * 24 | |
WEEK = DAY * 7 | |
if process.argv.length != 4 | |
console.log "Insufficient arguments to complete call" |
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 bash | |
print_usage() { | |
echo " Usage: $0 [upper-threshold]" | |
} | |
if [ -z $1 ]; | |
then | |
echo "ERROR: upper threshold should be specified" | |
print_usage |
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
/** | |
* Copyright 2016 Avinash Ananth Narayan R | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
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
OkHttpClient createClient() { | |
final OkHttpClient client = new OkHttpClient(); | |
// ... | |
client.networkInterceptors().add(chain -> { | |
Request request = chain.request(); | |
if (DEBUG) { | |
log(request); | |
} else { | |
String protocolPrefix = request.isHttps() ? "S" : ""; | |
Log.i(TAG, String.format("---> HTTP%s %s %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
package main | |
import ( | |
logging "github.com/op/go-logging" | |
"io/ioutil" | |
"log" | |
"os" | |
"testing" | |
) |
OlderNewer