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
| puts "event".ljust(20) + | |
| "line".ljust(10) + | |
| "id".ljust(20) + | |
| "binding".ljust(30) + | |
| "classname".ljust(10) | |
| set_trace_func proc { |event, file, line, id, binding, classname| | |
| puts event.to_s.ljust(20) + | |
| line.to_s.ljust(10) + | |
| id.to_s.ljust(20) + |
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
| a = [1,2] | |
| b = case a | |
| when [1,1] | |
| "hi" | |
| when [2,2] | |
| "hello" | |
| when [1,2] | |
| "heya" | |
| end |
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
| # ~/.bashrc | |
| alias nuke-branch="nuke_branch" | |
| function nuke_branch() | |
| { | |
| if [ $# -eq 1 ]; then | |
| git fetch upstream | |
| git branch -D tempbranch &> /dev/null | |
| git checkout -b tempbranch | |
| git branch -D $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
| object HelloWorld { | |
| class StringHelper(s: String) { | |
| def exclaim() = { s + "!!!" } | |
| } | |
| def main(args: Array[String]) { | |
| implicit def stringWrapper(s: String) = new StringHelper(s) | |
| println("asdf".exclaim()) | |
| } | |
| } |
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
| # spec/models/post_spec.rb | |
| require "spec_helper" | |
| require "post" | |
| describe Post do | |
| it "gets a post by id" do | |
| mock_apis([post_mocker]) do | |
| post = Post.get_by id: "dummy-id" |
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
| class Object; def if(&block); (yield(self))? self : nil; end; end; | |
| class String; def unless_empty; self.if { |a| a.size > 0 }; end; end; |
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
| // Autoload handlebars templates from <script> tags. | |
| $("script[type='text/x-handlebars-template'").each(function() { | |
| var $this = $(this); | |
| window[$this[0].id] = Handlebars.compile($this.html()); | |
| }); | |
| $("script[type='text/x-handlebars-partial'").each(function() { | |
| var $this = $(this); | |
| Handlebars.registerPartial($this[0].id, $this.html()); | |
| }); |
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
| <?php | |
| function callback($buffer) { | |
| return (str_replace("thar", "there", $buffer)); | |
| } | |
| ob_start("callback"); | |
| ?> | |
| <h1>Hi thar!</h1> |
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
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| int isPrime(int64_t); | |
| int main(int argc, char *argv[]) { | |
| int64_t testPrime = 0xffffffffffffffc5LL; | |
| printf("%d", isPrime(testPrime)); | |
| return 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
| void PointFrom3Planes(float x1, float y1, float z1, float d1, float x2, float y2, float z2, float d2, float x3, float y3, float z3, float d3, float *px, float *py, float *pz) { | |
| // Calculate matrix of minors | |
| float matrixOfMinors[3][3] = { | |
| { | |
| (y2 * z3 - y3 * z2), | |
| (x2 * z3 - x3 * z2), | |
| (x2 * y3 - x3 * y2), | |
| }, | |
| { | |
| (y1 * z3 - y3 * z1), |