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
42,43d41 | |
< define('PLUGIN_OPEN_AVOID_DIRECT', FALSE); // TRUE or FALSE | |
< | |
160c158 | |
< global $vars, $_attach_messages, $notify, $notify_subject; | |
--- | |
> global $_attach_messages, $notify, $notify_subject; | |
190,221d187 | |
< if ($vars['extract_mode'] == 'on') { | |
< switch (strtolower(substr($file['name'], -4))) { |
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
// copy from Janx Spirit http://janxspirit.blogspot.jp/2011/11/introduction-to-casbah-scala-mongodb.html | |
//connect to a MongoDB server | |
val mongo = MongoConnection("anduin") | |
//create/connect to a collection | |
val coll = mongo("casbah_examples")("movies") | |
//drop collection | |
coll.dropCollection |
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
bind -r ^ resize-pane -R 5 | |
bind -r C-^ resize-pane -L 5 | |
bind 0 kill-pane | |
bind 2 split-window -v | |
bind 3 split-window -h |
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
; css-mode | |
(defun coding-style-css () | |
(setq css-indent-offset 2)) | |
(add-hook 'css-mode-hook 'coding-style-css) | |
; | |
(setq truncate-lines t) | |
(setq truncate-partial-width-windows t) |
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
; Grep description of specs2 unit specification in selected buffer on xyzzy | |
; Please copy & paste following code at your .xyzzy | |
; Usage: M-x grep-specs2-unit-selected-buffer | |
(defun grep-specs2-unit-selected-buffer () | |
(interactive) | |
(grep " should \\| in " (selected-buffer))) |
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 compute1(maybeFoo: Option[Foo]): Option[Int] = | |
for { | |
foo <- maybeFoo | |
bar <- foo.bar | |
baz <- bar.baz | |
} yield baz.compute | |
// for compute2 | |
import scalaz._ | |
import Scalaz._ |
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
for { | |
foo <- maybeFoo | |
bar <- foo.bar | |
baz <- bar.baz | |
} yield baz.compute |
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
if (foo != null) { | |
Bar bar = foo.getBar(); | |
if (bar != null) { | |
Baz baz = bar.getBaz(); | |
if (baz != null) | |
return baz.compute(); | |
else | |
return null; | |
} | |
else |
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
// see https://gist.github.com/2382341 | |
// scalaz for only solution3 | |
import scalaz._ | |
import Scalaz._ | |
object SolutionForMultiNestedMatchforMyStudy { | |
def f(num: Int): Option[Int] = { | |
num match { |
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
object HexBytesUtil { | |
def hex2bytes(hex: String): Array[Byte] = { | |
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toByte) | |
} | |
def bytes2hex(bytes: Array[Byte], sep: Option[String] = None): String = { | |
sep match { | |
case None => bytes.map("%02x".format(_)).mkString | |
case _ => bytes.map("%02x".format(_)).mkString(sep.get) |