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
| (defun insert-unix-timestamp () | |
| "Insert the current time as unix timestamp." | |
| (interactive) | |
| (insert (format-time-string "%s"))) |
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 escript | |
| %% -*- erlang -*- | |
| %%! -smp enable -sname convert_binary_ring -mnesia debug verbose | |
| main([RingFile, OutFile]) -> | |
| try | |
| {ok, Binary} = file:read_file(RingFile), | |
| Ring = binary_to_term(Binary), | |
| try | |
| file:write_file(OutFile, io_lib:format("~p.~n", [Ring])), |
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
| source "http://rubygems.org/" | |
| ruby "2.1.1" | |
| gem 'docx', '~> 0.2.03' |
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
| require 'yaml' | |
| module BetterYaml | |
| def self.write_yaml_file(file, data) | |
| self.with_syck_engine do | |
| File.open(File.expand_path(file), "w", :encoding => "utf-8") {|f| YAML.dump(data, f) } | |
| end | |
| end | |
| def self.load_yaml_file(file) |
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
| // get your image | |
| var image = UIImage(named: "image.jpg") | |
| // begin a new image | |
| UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false, UIScreen.mainScreen().scale) | |
| // add a clip in the shape of a rounded rectangle | |
| UIBezierPath(roundedRect: imageView.bounds, cornerRadius: 10.0).addClip() | |
| // draw the image in the view | |
| image.drawInRect(imageView.bounds) | |
| // set the image | |
| imageView.image = UIGraphicsGetImageFromCurrentImageContext() |
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
| // accumulator function | |
| func accumulator(initial: Int, incrementBy: Int) -> () -> Int { | |
| var value = initial | |
| func accum() -> Int { | |
| value += incrementBy | |
| return value | |
| } | |
| return accum | |
| } |
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
| extension Array { | |
| func partition(iterator: (T) -> Bool) -> (Array<T>, Array<T>) { | |
| var ifTrue = Array<T>() | |
| var ifFalse = Array<T>() | |
| self.each { | |
| if iterator($0) == true { | |
| ifTrue.append($0) | |
| } else { | |
| ifFalse.append($0) | |
| } |
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
| extension Array { | |
| func each(iterator: (T) -> Void) -> Array { | |
| for item in self { | |
| iterator(item) | |
| } | |
| return self | |
| } | |
| } |
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
| (defun resque-web () | |
| "Launch resque-web locally on the default port" | |
| (interactive) | |
| (shell-command "open http://0.0.0.0:5678/")) |
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
| ;; Color configuration | |
| (set-face-attribute 'mode-line | |
| nil | |
| :foreground "light green" | |
| :background "firebrick1" | |
| :box '(:line-width 1 :style released-button)) | |
| (set-face-attribute 'mode-line-inactive | |
| nil | |
| :foreground "maroon4" |