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 test; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import junit.framework.TestCase; | |
class Robin { | |
private int i; |
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
# terminal command for monitoring http requests | |
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*" |
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
desc 'Stop rails server' | |
task :stop do | |
File.new("tmp/pids/server.pid").tap { |f| Process.kill 9, f.read.to_i }.delete | |
end | |
desc 'Starts rails server' | |
task :start do | |
Process.exec("rails s puma -d") | |
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 EventTarget() { | |
this._listeners = {}; | |
} | |
EventTarget.prototype = { | |
constructor: EventTarget, | |
addListener: function(type, listener){ | |
if (typeof this._listeners[type] == "undefined"){ |
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.method = function (name, func) { | |
this.prototype[name] = func; | |
return this; | |
}; | |
String.method('trim', function () { | |
return this.replace(/^\s+|\s+$/g, ''); | |
}); |
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 | |
#------------------------------------------------------------------------------ | |
# Name: sbt-template.sh | |
# Purpose: Create an SBT project directory structure | |
# Usage: project=foo ./sbt-template.sh | |
#------------------------------------------------------------------------------ | |
set -e | |
if [ -d "${project}" ]; then | |
echo "ERROR: Directory with specified ${project} name exist." |
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
var ko = require('knockout'); | |
ko.components.register('simple-name', require('./simple-name.js')); | |
ko.applyBindings({ userName: ko.observable() }); |
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 org.jooq.impl.TableImpl | |
import org.jooq.Record | |
object InsertInto { | |
// This enables you to write inserts like this | |
// Tables.USER_TABLE.save(userRecord) | |
implicit class EnhancedTableImpl[T <: Record](val table: TableImpl[T]) extends AnyVal { | |
def save(record: T)(implicit context: DSLContext) = { | |
val fields = record.fields().toSeq | |
context |
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 | |
while getopts ":i:o:s:" opt; do | |
case $opt in | |
s) | |
ss=$OPTARG | |
;; | |
i) | |
input=$OPTARG | |
;; |
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
// Fire up that repl! | |
// You can't mix apple and oranges | |
var orange: String = "nice sweet orange" | |
var apple: Int = 10 | |
orange = apple // error: type mismatch | |
// You should keep info about the type all the time | |
var oranges: List[String] = List("sweet 1", "sweet 2") | |
var apple: Int = 10 |
OlderNewer