This file contains hidden or 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 pascalsTriangle(n) | |
return [] if n < 0 | |
return [1] if n == 0 | |
ret = Array.new(n, []).map.each_with_index {|a, i| a = Array.new(i+1,1)} | |
(1..n-1).each do |y| | |
(0..y).each do |x| | |
idy1 = y - 1 | |
idx1 = x - 1 |
This file contains hidden or 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 ruby | |
######################## | |
# The world's simplest twitter client | |
# 1- Get an API key form https://dev.twitter.com with read/write access, enter details below @'ENTER_HERE' | |
# 2- gem install twitter | |
# 3- ./post | |
# 4- Start posting | |
######################## | |
require "rubygems" |
This file contains hidden or 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 | |
IFS=" | |
" | |
echo | |
for FRAME in \ | |
" B :^)" \ | |
" B :^)" \ | |
" B :^)" \ | |
" B :^)" \ |
This file contains hidden or 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
final ImageView image = (ImageView) findViewById(R.id.imageview_to_animate); | |
Animation rotate = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_picture); | |
image.startAnimation(rotate); |
This file contains hidden or 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"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shareInterpolator="true" android:ordering="sequentially"> | |
<rotate | |
android:fromDegrees="0" | |
android:toDegrees="30" | |
android:duration="500" | |
android:pivotX="50%" | |
android:pivotY="50%"> | |
</rotate> |
This file contains hidden or 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 sbt._ | |
import Keys._ | |
import play.Project._ | |
object ApplicationBuild extends Build { | |
val appName = "chain-mail" | |
val appVersion = "1.0-SNAPSHOT" | |
val appDependencies = Seq( |
This file contains hidden or 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 ruby | |
# remove names from file1 contained in file2 | |
unique_entries = File.readlines(ARGV[0]) - File.readlines(ARGV[1]) | |
unique_entries.each{|l| puts l} |
This file contains hidden or 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 com.phyous.leap | |
import java.io.IOException | |
import java.lang.Math | |
import com.leapmotion.leap._ | |
import com.leapmotion.leap.Gesture.State | |
class SampleListener extends Listener { | |
override def onInit(controller: Controller) { |
This file contains hidden or 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 com.phyous.leap | |
import java.io.IOException | |
import com.leapmotion.leap._ | |
object App { | |
def main(args: Array[String]) { | |
val listener = new SampleListener | |
val controller = new Controller |
This file contains hidden or 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
% echo "{\"array\":[1,2,3],\"boolean\":true}" | json | |
{ | |
"array": [ | |
1, | |
2, | |
3 | |
], | |
"boolean": true | |
} |