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
const ( | |
MAX_SAMPLE_COUNT = 50 | |
MAX_SAMPLE_COUNT_F = float64(MAX_SAMPLE_COUNT) | |
) | |
type Stat struct { | |
sync.Mutex | |
hits int64 | |
samples []int | |
} |
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
defmodule Math do | |
def add(x, y) do | |
x + y | |
end | |
def add(x, y, z) do | |
x + y + z | |
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
ActionController::Routing::Routes.draw do |map| | |
map.twitter 'twitter', :controller => "twitter", :action => "twitter" | |
map.root :controller => "twitter" | |
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
<!-- ui-dialog --> | |
<div id="dialog-password-forget-form"> | |
<%= form_tag forgot_password_path, :id => "submit-forgot-password" do %> | |
<fieldset id="user-email"> | |
<p> | |
<label>Email address<span><%= email_field_tag :email, '', :id => "email" %></span></label> | |
</p> | |
</fieldset> | |
<% end %> | |
</div> |
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
this is a partial. <%= model.value %> |
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
1. Use latest build | |
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git' | |
2. Create an initializer | |
# /config/initializers/simple_form.rb | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a complete input. | |
# You can remove any component from the wrapper, change the order or even |
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
class EmailQueue | |
include Sidekiq::Worker | |
def perform(options) | |
mailer = options['mailer'].constantize | |
method = options['method'] | |
args = options['args'] | |
mailer.send(method, *args).deliver | |
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
cd ~ | |
sudo apt-get update | |
sudo apt-get install curl python-software-properties -y | |
sudo apt-get install openjdk-6-jre-headless | |
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz | tar -xz | |
sudo mv elasticsearch-* /usr/local/share/elasticsearch | |
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz | |
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/ | |
rm -Rf *servicewrapper* |
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
import React from 'react' | |
export default class Dropdown extends React.Component{ | |
constructor(props){ | |
super() | |
this.state = { show: props.show } | |
this.onClick = this.onClick.bind(this) | |
} | |
onClick(){ |
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
class SomeController < ApplicationController | |
before_action :add_http_preload | |
private | |
def add_http_preload | |
# Always add a Link header to responses to this controller | |
http_preload script: "application.js", style: "application.css" | |
http_preload "myfont.woff", as: :font, push: false | |
# TODO: How should crossorigin work? |
OlderNewer