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 "minitest/autorun" | |
12 | |
11 module Numerics | |
10 def twenty_one?(*nums) | |
9 nums.inject(&:+) == 21 | |
8 end | |
7 end | |
6 | |
5 class TestNumerics < MiniTest::Test | |
4 include Numerics |
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
# Configure Terminal prompt | |
get_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
get_ruby_version() { | |
ruby -e "print RUBY_VERSION" | |
# If you're using rbenv and want to know | |
# the local version and not the global | |
# use this instead: |
Collection+JSON is a hypermedia-type for APIs.
- When using the
inline
property, which lets you nest C+J objects, how deep can the nesting go? Can, by instance, nested collections have templates? - Imagine a
template
that can take multiple elements of a given kind (i.e. a Customer to which we can add multiple Addresses). How does this multiplicity reflect on the template?
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
/** | |
* Fetch Img Src | |
* Helper function to get an image source from an <img> tag | |
*/ | |
function tm_fetch_img_src( $img_tag ) { | |
return preg_match( '@src="([^"]+)"@' , $img_tag , $src ); | |
} |
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
# Devise 3.1.0 | |
ca: | |
devise: | |
confirmations: | |
confirmed: "El teu compte ha estat confirmat correctament. Si us plau, inicia la sessió." | |
confirmed_and_signed_in: "El teu compte ha estat confirmat correctament. S'ha iniciat la sessió." | |
send_instructions: 'En breu rebràs un correu electrònic amb instruccions sobre com confirmar el teu compte.' | |
send_paranoid_instructions: "Si la teva adreça electrònica existeix a la base de dades, rebràs un correu electrònic amb instruccions sobre com confirmar el teu compte." | |
failure: |
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( $ ){ | |
$.fn.substitute_with = function(r, w) { | |
$(this).html($(this).text().split(r).join(w)); | |
return this; | |
}; | |
})( jQuery ); | |
// Usage example |
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
/** | |
* Custom WP gallery | |
*/ | |
add_shortcode('gallery', 'my_gallery_shortcode'); | |
function my_gallery_shortcode($attr) { | |
$post = get_post(); | |
static $instance = 0; | |
$instance++; |
NewerOlder