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 ContactMailer < ActionMailer::Base | |
def receive(email) | |
ContactMailer.contact_admins(email).deliver | |
end | |
def contact_admins(orig_email) | |
m = mail(to: 'info@doorkeeper.jp', subject: 'Received email') do |format| | |
format.text { render } | |
format.html { render } |
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
# put this in /usr/local/Library/Taps/homebrew/homebrew-versions/elasticsearch10.rb | |
# $ ln -s ../Taps/homebrew/homebrew-versions/elasticsearch10.rd /usr/local/Library/Formula/elasticsearch10.rb | |
# $ brew install elasticsearch10 | |
require 'formula' | |
class Elasticsearch10 < Formula | |
homepage 'http://www.elasticsearch.org' | |
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.tar.gz' | |
sha1 '26bcf8e36576b2f3809ab84432ea005f893836b9' |
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
#!/bin/bash | |
ES_VERSION="1.1.1" | |
ES_PORT="9333" | |
PWD=`pwd` | |
mkdir -p ~/elasticsearch/ | |
cd ~/elasticsearch/ | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.zip |
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
Verifying I am +mreinsch on my passcard. https://onename.com/mreinsch |
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
require 'net/http' | |
require 'base64' | |
require 'cgi' | |
require 'json' | |
class CoBot | |
HEADERS = { | |
'Accept' => 'application/json', | |
'Content-Type' => 'application/json; charset=utf-8', | |
'User-Agent' => 'Harvest Twitter Script' } |
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
require 'rubygems' | |
require 'shoulda' | |
class SimpleTest < Test::Unit::TestCase | |
context 'with 100' do | |
setup { @total = 100 } | |
should("return 100") { assert_equal(100, @total.to_i) } | |
end | |
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
Your system is raring to brew. |
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
# some helpers to make integration testing with elasticsearch easier | |
# expects Capybara | |
# modify this! | |
MODELS_WITH_ELASICSEARCH_MODEL = [Group, Event] | |
begin | |
MODELS_WITH_ELASICSEARCH_MODEL.each do |c| | |
c.__elasticsearch__.create_index! force: true | |
c.__elasticsearch__.refresh_index! |
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 Event < ActiveRecord::Base | |
include Elasticsearch::Model | |
belongs_to :group | |
after_save { IndexerJob.perform_later('update', self.class.name, self.id) } | |
after_destroy { IndexerJob.perform_later('delete', self.class.name, self.id) } | |
def in_search_index? | |
published? && group.in_search_index? |
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
$ git branch -r --merged master | | |
awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | | |
xargs git push origin --delete |
OlderNewer