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 max_overshoot(task_table) | |
@cache_result ||= {} | |
result = @cache_result[task_table] | |
return result if result | |
prev = 0 | |
prev = max_overshoot(task_table[0..-2]) if task_table.size > 1 | |
total_duration = task_table.reduce(0) {|i, s| i+s[:duration]} |
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
require 'benchmark' | |
n = 50000000 | |
Benchmark.bm(15) do |x| | |
x.report("regexp1") { 1.upto(n) do ; "XMLHttpReQUEst" =~ /XMLHttpRequest/i; end } | |
x.report("regexp2") { 1.upto(n) do ; "XMLHttpReQUEst" =~ /xmlhttprequest/i; end } | |
x.report("downcase") { 1.upto(n) do ; 'XMLHttpReQUEst'.downcase == 'xmlhttprequest'; end } | |
x.report("strip+downcase") { 1.upto(n) do ; ' XMLHttpReQUEst '.strip!.downcase! == 'xmlhttprequest'; end } | |
end |
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
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
ui = true | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green |
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
<html> | |
<head> | |
<title> | |
Demo Cross Domain | |
</title> | |
<!-- Le styles --> | |
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> | |
<style> | |
body { |
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
.... | |
<h2>Installation</h2> | |
<p>OK. First, you need a running <em>Elasticsearch</em> server. Thankfully, it's easy. Let's define easy:</p> | |
<pre><code>$ curl -k -L -o elasticsearch-0.20.2.tar.gz http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz | |
$ tar -zxvf elasticsearch-0.20.2.tar.gz | |
$ ./elasticsearch-0.20.2/bin/elasticsearch -f | |
</code></pre> |
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
# Path to your oh-my-zsh configuration. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="aussiegeek" | |
# Example aliases |
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
gem: --no-rdoc --no-ri |
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/bash | |
function info_kill() { | |
local frame=0 | |
while caller $frame; do | |
((frame++)); | |
done | |
echo "kill $*" |
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
Motion::Project::App.setup do |app| | |
#Simple example to generate a pretty build version | |
app.version = `git log -n 1 --pretty=format:'%h'`.upcase | |
app.short_version = '1.0' | |
#... | |
end |
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
Motion::Project::App.setup do |app| | |
# Find Provising profile depends on Profile name | |
# https://github.com/HipByte/RubyMotion/blob/master/lib/motion/project/template/ios/config.rb#L88 | |
app.provisioning_profile('IOS Wildcard Team Profile') | |
#or use same as app name | |
app.provisioning_profile(app.name) | |
# ... | |
end |