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
You can represent time statements in most western languages where | |
a prefix and/or suffix is used. | |
The default case is to use suffix only (as in English), which you | |
do by providing the `suffixAgo` and `suffixFromNow` settings in | |
the strings hash (earlier versions of timeago used the deprecated | |
`ago` and `fromNow` options). If present, they are used. | |
2 minutes [suffixAgo] | |
2 minutes [suffixFromNow] |
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
# Resolving permission corruption | |
chmod -R 755 photos | |
find photos/ -type f -perm 755 -print0 | xargs -0 chmod 644 |
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/sh | |
# http://onrails.org/articles/2009/09/04/rmagick-from-source-on-snow-leopard | |
# install wget, which is cleverer than curl | |
# curl -O http://ftp.gnu.org/gnu/wget/wget-1.11.tar.gz | |
# tar zxvf wget-1.11.tar.gz | |
# cd wget-1.11 | |
# ./configure --prefix=/usr/local | |
# make |
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
Surround these with : e.g. :calling: | |
+1 | |
-1 | |
bulb | |
calling | |
clap | |
cop | |
feet |
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
@import "twitter/bootstrap"; | |
.whatever { | |
@extend .well; | |
} |
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
# This is a monkey patch for the SimpleForm issue (actually it's a Rails' collection_select issue) | |
# of adding attributes to select options. Downside is that you loose value/label_method options, | |
# but that's easily replacable by using map on the collection (and should be done in some decorator anyways). | |
# See here for more details about the issue: https://github.com/plataformatec/simple_form/issues/188 | |
module SimpleForm | |
module Inputs | |
class CollectionSelectInput < CollectionInput | |
def input | |
@builder.select attribute_name, collection, input_options, input_html_options | |
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
- title = 'auto_html demo' | |
- content_for :title, title | |
.page-header | |
%h1 | |
.pull-right | |
.btn-group | |
= link_to 'article', '/2010/08/15/auto_html', class: 'btn' | |
= link_to 'source', 'https://github.com/dejan/auto_html', class: 'btn' |
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
[18] pry(main)> expense.errors.keys | |
=> [] | |
[19] pry(main)> expense.errors[:something] | |
=> [] | |
[20] pry(main)> expense.errors.keys | |
=> [:something] ### !!! so getter on L19 changed the state | |
[21] pry(main)> expense.errors.has_key? :something |
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
package main | |
// using asymmetric crypto/RSA keys | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" |
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
// Solution to Pere's first Scala challenge | |
// by Dejan | |
object Compression { | |
// Drops element ++el++ and all its consecutive appearances in head of the list ++li++ | |
def chop(li: List[Any], el: Any) = { | |
li dropWhile (_ == el) | |
} | |
// Eliminates consecutive duplicates of list elements |