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 some_method | |
| 4 | |
| end | |
| some_method {|ret_val| puts ret_val} #=> 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
| // Turn this: | |
| $.post("/cameras/" + cameraId + "/wireless", { | |
| "_method": "delete" | |
| }, | |
| function(response) { | |
| $.prompt( | |
| "<h3>Disconnecting from Wireless</h3>" + | |
| "<ul><li class=\"processing\">Sending Request to Camera</li></ul>", { |
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
| // leaks memory because a copy of the value of scene is returned and the pointer is never deleted | |
| Image Scene::draw() const { | |
| Image scene = *(new Image()); | |
| // build the scene | |
| return *scene; | |
| } | |
| // doesn't leak memory, but is ugly |
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
| [user] | |
| name = Jason Roelofs | |
| email = jameskilton@gmail.com | |
| [color] | |
| diff = auto | |
| status = auto | |
| branch = auto | |
| [color "branch"] | |
| current = yellow reverse | |
| local = yellow |
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/perl -w | |
| # | |
| # Simple Flash Socket Policy Server | |
| # http://www.lightsphere.com/dev/articles/flash_socket_policy.html | |
| # | |
| # Copyright (C) 2008 Jacqueline Kira Hamilton | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or |
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
| CmdUtils.CreateCommand({ | |
| name: "wowhead", | |
| arguments: [{role: 'object', nountype: noun_arb_text, label: 'query'}], | |
| icon: "http://www.wowhead.com/favicon.ico", | |
| homepage: "http://www.wowhead.com", | |
| author: { name: "Carlos Moll", email: "carlos@tallon.org"}, | |
| license: "MPL,GPL", | |
| description: "Search Wowhead", | |
| help: "Search for an item, quest, NPC, etc on Wowhead", |
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 'benchmark' | |
| N = 1_000_000 | |
| a = [] | |
| 100.times { a << (rand(10) > 5 ? true : false) } | |
| Benchmark.bm(20) { |x| | |
| x.report("String#to_i(base)") { |
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
| # From http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' | |
| } | |
| function is_git_svn { | |
| git config --get svn-remote.svn.url > /dev/null | |
| if [ $? == 0 ]; then | |
| echo "(svn) " |
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
| function is_git_svn { | |
| git config --get svn-remote.svn.url > /dev/null | |
| if [ $? == 0 ]; then | |
| echo "(svn) " | |
| else | |
| echo "" | |
| fi | |
| } |
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
| roelofs@trillian [method_properties]~/projects/rice $ make | |
| Making all in rice | |
| make[1]: Entering directory `/home/roelofs/projects/rice/rice' | |
| make all-am | |
| make[2]: Entering directory `/home/roelofs/projects/rice/rice' | |
| g++ -DHAVE_CONFIG_H -I. -I/usr/lib/ruby/1.8/i686-linux -O2 -march=prescott -pipe -fno-strict-aliasing -fPIC -fPIC -I/usr/lib/ruby/1.8/i686-linux -MT Class.o -MD -MP -MF .deps/Class.Tpo -c -o Class.o Class.cpp | |
| Module_impl.ipp: In member function 'Derived_T& Rice::Module_impl<Base_T, Derived_T>::define_method(Rice::Identifier, Func_T, const Rice::Method_Property&)': | |
| Module_impl.ipp:147: error: there are no arguments to 'default_method_property' that depend on a template parameter, so a declaration of 'default_method_property' must be available | |
| Module_impl.ipp:147: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) | |
| Module_impl.ipp: In member function 'Derived_T& Rice::Module_impl<Base_T, Derived_T>::public_visibility() |