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
| # let's define this (bash) function to help us see what's happening: | |
| args() { echo "${#@} arguments:"; for arg in "$@"; do echo "-> $arg"; done; } | |
| # now let's see the differences between $@ and $*: | |
| # $*: expands into a series of words, basically ignoring all the quotes | |
| # you'll hardly ever want to do this | |
| test() { args $*; } | |
| test a "b b" c |
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
| $(document).ready(function(){ | |
| $("#tactics form").submit(function(e){ | |
| e.preventDefault(); | |
| }); | |
| //syntax highlight | |
| ChiliBook.recipeFolder = "./"; | |
| //observação: criei variáveis globais aqui a nivel de exemplo, mas isso não é recomendado. O ideal é criar objetos para armazenar esses valores. ;) |
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
| diff --git i/vm/llvm/jit_operations.hpp w/vm/llvm/jit_operations.hpp | |
| index f55a771..aa15021 100644 | |
| --- i/vm/llvm/jit_operations.hpp | |
| +++ w/vm/llvm/jit_operations.hpp | |
| @@ -293,7 +293,7 @@ namespace rubinius { | |
| Value* ptrtoint(Value* ptr) { | |
| return CastInst::Create( | |
| Instruction::PtrToInt, | |
| - ptr, Type::Int32Ty, "ptr2int", block_); | |
| + ptr, IntPtrTy, "ptr2int", block_); |
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/rbx -Xjit.enabled -e '' | |
| exception detected at toplevel: (StackError) | |
| kernel/alpha.rb:20 | |
| kernel/delta/kernel.rb:47 | |
| kernel/bootstrap/kernel.rb:43 | |
| kernel/delta/kernel.rb:18 | |
| kernel/delta/kernel.rb:47 | |
| kernel/bootstrap/kernel.rb:43 | |
| kernel/delta/kernel.rb:18 | |
| kernel/delta/kernel.rb:47 |
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
| (gdb) run | |
| The program being debugged has been started already. | |
| Start it from the beginning? (y or n) y | |
| Starting program: /home/daniel/Dev/rbx-llvm/bin/rbx | |
| [Thread debugging using libthread_db enabled] | |
| [New Thread 0x7f3468a41700 (LWP 28200)] | |
| [Switching to Thread 0x7f3468a41700 (LWP 28200)] | |
| Breakpoint 2, VMMethod (this=0x1e1e810, state=0x1de9580, meth=0x7f346720a518) |
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
| module Foo | |
| BAZ = 100 | |
| module Bar | |
| def self.baz | |
| BAZ | |
| end | |
| end | |
| end | |
| puts Foo::Bar.baz |
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
| @classmethod | |
| def get_page(cls, app_id, bookmark=None): | |
| pagesize = 15 | |
| first_fetch = not bookmark | |
| if first_fetch: | |
| ascending = False | |
| date = None | |
| elif bookmark.startswith('-'): # we're moving backwards | |
| ascending = False | |
| date = str_to_date(bookmark[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
| def coerce_to_array(v) | |
| if v.IS_A?(Array) # internal test, not #is_a? method call | |
| v | |
| elsif v.respond_to?(:to_ary) # replace with to_a for 1.9 | |
| result = v.to_ary | |
| if result.IS_A?(Array) | |
| result | |
| else | |
| raise TypeError | |
| 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
| # http://henrik.nyh.se/2008/12/git-dirty-prompt | |
| # http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| # username@Machine ~/dev/dir[master]$ # clean working directory | |
| # username@Machine ~/dev/dir[master*]$ # dirty working directory | |
| function parse_git_dirty { | |
| git diff --quiet HEAD &>/dev/null | |
| [[ $? == 1 ]] && echo "*" | |
| } | |
| function parse_git_branch { |