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 akka.actor.{Actor, ActorLogging, ActorSystem, Props} | |
object Factorial extends App { | |
val factorials = List(200000, 180000, 320000, 280000, 220000, 420000, 550000, 480000) | |
val system = ActorSystem("factorial") | |
val collector = system.actorOf(Props(new FactorialCollector(factorials)), "fac-coll") | |
system.awaitTermination() |
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
Show hidden characters
{ | |
"browser": true, // specifies globals exposed by modern browsers | |
"strict": true, // specifies that restricted JavaScript is used | |
"indent": 2, // indentation should consistently be 2 spaces | |
"nonew": true, // prevents using constructers for side effects | |
"noarg": true, // prevents using deprecated caller,callee methods | |
"eqeqeq": true, // prevents equality == and != operators from being used | |
"bitwise": true, // prevents bitwise & and | operators from being used |
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 ( | |
"fmt" | |
"math/big" | |
"runtime" | |
) | |
func main() { | |
runtime.GOMAXPROCS(runtime.NumCPU()) |
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
before_filter :hash_options | |
def hash_options | |
params[:options] = Hash[*((params[:options].size % 2) == 0) ? params[:options] : (params[:options] + [nil])] if params[:options] | |
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
(function(){ | |
var eventMatchers = { | |
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, | |
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/ | |
} | |
var defaultOptions = { | |
pointerX: 0, | |
pointerY: 0, | |
button: 0, | |
ctrlKey: false, |
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
namespace :tmp do | |
namespace :assets do | |
desc "Clears javascripts/cache and stylesheets/cache" | |
task :clear => :environment do | |
FileUtils.rm(Dir['public/javascripts/cache/[^.]*']) | |
FileUtils.rm(Dir['public/stylesheets/cache/[^.]*']) | |
end | |
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
window.scope = "window"; | |
Function.prototype.bind = function(scope) { | |
var _function = this; | |
return function() { | |
return _function.apply(scope, arguments); | |
} | |
} |
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.prototype.bind = function(scope) { | |
_function = this; | |
return function() { | |
_function.apply(scope, arguments); | |
} | |
} | |
window.scope = "window"; |
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
Hash.fromQueryString = function(string) { | |
var hash = new Hash(); | |
var array = string.gsub(/^#/, '').split(/=|&/); | |
for (var i = 0; i < array.length; i+=2) { | |
if(array[i +1] != undefined) { | |
hash.set(array[i], array[i + 1]); | |
} | |
} |
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
name.downcase.gsub(/'/, "").gsub(/[^[:alnum:]]/, "_").gsub(/_{2,}/, "_").gsub(/^_|_$/, "") | |
# scrub out: ^contractions ^non-alpha-num characters ^extra underscores ^other underscores |
OlderNewer