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
PROMPT=$'╭%{$fg_bold[blue]%}%n%{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ | |
╰>%{$reset_color%} ' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
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
ActiveAdmin.register CityNeighbourhood do | |
member_action :change_neighbourhoods, :method => :get do | |
@neighbourhoods = City.find_by_id(params[:city_id]).try(:neighbourhoods) | |
render :text => view_context.options_from_collection_for_select(@neighbourhoods, :id, :name) | |
end | |
#... | |
form do |f| | |
f.input :city, input_html: { | |
onchange: remote_get("change_neighbourhoods", 'city_id', :neighbourhood_id) | |
} |
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
class Coins(coinType: Symbol) { | |
def value: Double = coinTypesDictionary(coinType) | |
def toOneDollar: Double = 1.0 / this.value | |
} | |
object Coins{ | |
private val coinTypesDictionary = Map[Symbol, Double]('penny -> 0.01, 'nickel -> 0.05, 'dime -> 0.10, 'quarter -> 0.25 ) | |
def coinTypes: Iterable[Symbol] = coinTypesDictionary.keys | |
} |
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
<h1>Listing Posts</h1> | |
<% for post in @posts: %> | |
<div class="item" data-id="<%= post.id %>"> | |
<a data-type="show"><%= post.title %></a> | |
<a data-type="edit">Edit</a> | |
<a data-type="destroy">Destroy</a> | |
</div> | |
<% end %> | |
<p><a data-type="new">New Post</a></p> |
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
#include <stdlib.h> // for itoa() call | |
#include <stdio.h> // for printf() call | |
int main() { | |
int num = 123; | |
char buf[5]; | |
// convert 123 to string [buf] | |
itoa(num, buf, 10); |