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
content_tag('input', 'Where would you like to go?', { data: {goTo: 'www.google.com'} }) | |
=> <input value="Where would you like to go?" data-go-to="www.google.com" /> |
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
Desktop% ruby -v (~/Desktop) | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] | |
Desktop% cat benchmark_quotes.rb (~/Desktop) | |
require 'benchmark' | |
n = 1000000 | |
Benchmark.bm do |x| | |
x.report('assign single') { n.times do; c = 'a string'; end } | |
x.report('assign double') { n.times do; c = "a string"; end } | |
x.report('assign interp') { n.times do; c = "a string #{'b string'}"; end } |
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
If I use the hotkeys ctrl+alt+up/down/left/right then it always makes the keys stick. | |
The s key sticks, but if I press ctrl+s it fixes it. | |
The o key sticks and I can only fix that if I frantically press alt, ctrl or shift keys with the o key. |
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
$the_cow = <<EOC; | |
$thoughts | |
$thoughts | |
/\\__/\\ | |
/` '\\ | |
=== 0 0 === | |
\\ -- / | |
/ \\ | |
/ \\ | |
| | |
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
<ul> | |
<% for (var p in params) { %> | |
<li><%= p + ': ' + params[p]; %></li> | |
<% } %> | |
</ul> |
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
#!/bin/bash | |
PREFIX=${PREFIX-/usr/local} | |
NVM_DIR="$PREFIX/lib/nvm" | |
VERSIONS_DIR="$NVM_DIR/versions" | |
CURRENT_NVM="$NVM_DIR/current" | |
LOGPATH="/tmp/nvm.log" | |
# Exit with message | |
abort() { |
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 class="hero-unit"> | |
<h2>All <%= names.constructor.plural %></h2> | |
<%%- linkTo('Create a new <%= names.constructor.singular %>'), {controller: '<%= names.property.plural %>', action: 'add'}, {class: 'btn pull-right'}) %> | |
</div> | |
OUTPUT: | |
<div class="hero-unit"> | |
<h2>All Users</h2> | |
<%- linkTo('Create a new User'), {controller: 'users', action: 'add'}, {class: 'btn pull-right'}) |
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
package main | |
import "fmt" | |
func swap(x, y, string) (string, string) { | |
return y, x | |
} | |
func main() { | |
a, b := swap("world", "Hello") |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type MyError struct { | |
When time.Time | |
Type, Message string |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"errors" | |
) | |
func run() (str string, err error) { | |
time := time.Now() |