This file contains 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
ActiveResource/Rails confuses parameter values when deserializing. | |
Using ActiveResource 2.3.8 (AccountUpdate is ActiveResource class) with ruby 1.8.7. | |
The REST server is a Rails 3.0.0beta4 running ruby 1.9.2. | |
Set up two hashes, one containing an _id value, the other not. The Hash with the | |
_id field has a :name value of "hello", the other hash contains only the :name field | |
with value fubar. | |
============= |
This file contains 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
Something that happened to me the other day -- rounding on the 5th value after the decimal point. | |
Ruby code that was tested: | |
puts "%.2f" % 1.234 | |
puts "%.2f" % 1.235 | |
puts "%.4f" % 1.23523 | |
puts "%.4f" % 1.23525 | |
The last value should be 1.2353 (at least that is what i learnt in my maths classes) |
This file contains 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
div | |
&.spinner | |
position: relative | |
width: 100px | |
height: 100px | |
display: inline-block | |
div | |
width: 12% | |
height: 26% | |
background: #000 |
This file contains 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 rvm_version { | |
if [ -x ~/.rvm/bin/rvm-prompt ] ; then | |
echo $(~/.rvm/bin/rvm-prompt) | |
else | |
echo " - no rvm - " | |
fi | |
} | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
This file contains 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
ALIAS_FILE_CDS=~/.bash_aliases_cd | |
function _funct_cd_alias_add | |
{ | |
local name=$1 | |
name=$(echo $name | sed s/^cd-//) # remove any leading cd- (we'll add that) | |
local varname=$(echo $name | sed s/-/_/g) # replace minus with underscore | |
shift | |
local directory=$* # can't do replace on $* value directly -- man bash for more | |
if [ "$directory" == "" ]; then |
This file contains 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 _funct_find_rails | |
{ | |
local app="" | |
local option= | |
local what=$* | |
OPTIND=1 | |
while getopts "a:es:" option | |
do | |
case $option in | |
e) |
This file contains 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 _funct_dbctl { | |
local action dbname logfile cmd | |
action=$1 ; shift ; dbname=$1 ; logfile="" | |
case $dbname in | |
mysql) | |
dbname="org.macports.mysql5" | |
;; | |
mongo) | |
echo "launchctl load /opt/local/etc/LaunchDaemons/org.macports.mongodb" | sudo bash 2>/dev/null |
This file contains 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
var XibsToConvert = ["FlickrWindow", "FacebookWindow", "TwitterWindow", | |
"YouTubeWindow", "LinkTEProperties", "HighlightTEProperties", | |
"ImageTEProperties", "TwitterFeedTEProperties","TextTEProperties"]; | |
task( "nibs", function() | |
{ | |
// Tried using JAKE.file but that didn't not want to work with subdirectories, | |
// i.e. Resources/ | |
for ( var idx = 0; idx < XibsToConvert.length; idx++ ) { | |
var filenameXib = "Resources/../Xibs/" + XibsToConvert[idx] + ".xib"; |
This file contains 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
(define-derived-mode dhcp-mode | |
c-mode "DHCP config" | |
"Major mode for DHCP configuration files. | |
\\{dhcp-mode-map}" | |
(setq case-fold-search nil)) | |
(defvar dhcpdGroupDecl-keywords | |
'("group" "shared-network" "subnet" "host" "pool" "failover" | |
"class" "subclass" "key" "zone" "logging" "channel" "netmask") | |
"DHCP group declaration keywords.") |
This file contains 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
/* | |
* Provide a simple mixin helper to extend classes without inheritence. At the same | |
* time, this demostrates various scenarios when using mixins. | |
* | |
* For more information, check out (branch URL - release 0.8.1 of cappuccino) | |
* https://github.com/280north/cappuccino/blob/release-0.8.1/Objective-J/Runtime.js | |
* Note: this code is base on version 0.8.1 of Cappuccino. | |
* | |
* Install OJTest framework (https://github.com/280north/OJTest/wiki) and this class | |
* can be called: |
OlderNewer