Skip to content

Instantly share code, notes, and snippets.

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=""
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)
}
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
}
@Dglgmut
Dglgmut / index.jst.eco
Created January 26, 2012 16:00
Weird exception on Execjs with the 'for' operator, but everything works fine if I use another operator.
<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>
@Dglgmut
Dglgmut / uininoobao
Created November 9, 2011 00:35
uini
‎#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);