Skip to content

Instantly share code, notes, and snippets.

View gatspy's full-sized avatar

CG.gatspy gatspy

View GitHub Profile
anonymous
anonymous / gist:2411966
Created April 18, 2012 08:13
package gtan
object Succ {
def main(args: Array[String]) {
assert(succ("") == "")
assert(succ("3") == "4")
assert(succ("R2D3") == "R2D4")
assert(succ("R293") == "R294")
assert(succ("R2D9") == "R2E0")
object Succ {
def main(args: Array[String]) {
assert(succ("") == "")
assert(succ("3") == "4")
assert(succ("R2D3") == "R2D4")
assert(succ("R293") == "R294")
assert(succ("R2D9") == "R2E0")
assert(succ("A99") == "B00")
assert(succ("Z99") == "AA00")
assert(succ("Zz99") == "AAa00")
object Succ {
def main(args: Array[String]) {
assert(succ("") == "")
assert(succ("3") == "4")
assert(succ("R2D3") == "R2D4")
assert(succ("R293") == "R294")
assert(succ("R2D9") == "R2E0")
assert(succ("A99") == "B00")
assert(succ("Z99") == "AA00")
assert(succ("Zz99") == "AAa00")
@notyy
notyy / gist:2470138
Created April 23, 2012 10:31
random
def shuffle[T](t: Int, l: List[T]): List[T] = (t,l) match {
case (0, _) => Nil
case (x, Nil) => Nil
case (x, ls) => {
import scala.util.Random
val r = ls(Random.nextInt(ls.length))
r :: shuffle(x-1, ls.filterNot(item => item == r))
}
}
@tomschenkjr
tomschenkjr / sublime-path
Last active October 5, 2015 18:58
Setting PATH for Sublime Text 2
{
"default_extend_env":{"PATH":"{PATH};C:\\Users\\user_name\\Documents\\R\\R-2.14.1\\bin\\x64"}
}
@yamaya
yamaya / xcode-clang-vers
Last active November 4, 2025 02:31
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@lotem
lotem / default.custom.yaml
Last active October 29, 2025 06:36
使用 Control 鍵切換中西文,上屏已輸入的編碼;令 Caps Lock 改變字母的大小寫
# 中西文切換鍵的默認設置寫在 default.yaml 裏面
# 以下的 default.custom.yaml 在全局範圍重定義該組快速鍵
#
# 可用的按鍵有 Caps_Lock, Shift_L, Shift_R, Control_L, control_R
# Mac 系統上的鼠鬚管不能區分左、右,因此只有對 Shift_L, Control_L 的設定起作用
#
# 已輸入編碼時按切換鍵,可以進一步設定輸入法中西文切換的形式。
# 可選的臨時切換策略有三:
# inline_ascii 在輸入法的臨時西文編輯區內輸入字母、數字、符號、空格等,回車上屏後自動復位到中文
# commit_text 已輸入的候選文字上屏並切換至西文輸入模式
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 24, 2025 05:26
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"