Skip to content

Instantly share code, notes, and snippets.

Avatar
🐔
In the chicken

FUNABARA Masao masoo

🐔
In the chicken
View GitHub Profile
View mail-test.rb
require 'mail'
Mail.defaults do
options = { :address => "smtp.gmail.com",
:port => 587,
:user_name => 'kosaki.motohiro',
:password => 'パスワード',
:authentication => 'plain',
:enable_starttls_auto => true }
@aq2bq
aq2bq / seeds.rb
Last active Jul 28, 2016
[JPローカライズ]Spree 2.1.1 with Rails4 用シードファイル
View seeds.rb
# encoding: utf-8
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
@aq2bq
aq2bq / seeds.rb
Last active Jul 28, 2016
[JPローカライズ] Spree 2.0.x 向け seeds.rb (Spree 2.1.1 with Rails4 用は https://gist.github.com/aq2bq/6790523 )
View seeds.rb
# encoding: utf-8
Rails.application.config.active_record.whitelist_attributes = false
ActiveRecord::Base.class_eval do
class << self
def create_or_update! attrs={}
instance = first_or_initialize(attrs, :without_protection => true)
instance.save!
end
@korny
korny / jquery_ujs.prompt.js.coffee
Last active Jul 3, 2017
Simple prompt functionality for Rails / jQuery UJS, modelled after "confirm". Tested with Rails 4 (edge).
View jquery_ujs.prompt.js.coffee
# Usage: link_to …, prompt: { message: 'Some message', default: 'default value', param: 'name of parameter' }
# The prompt will ask for "message" and use "default" as the default value.
# Unless user selects cancel, "param"=<new value> will be sent to the given path.
# Optionally, you can just use `prompt: "message"`.
$.rails.prompt = (message, defaultValue) ->
window.prompt message, defaultValue
$.rails.handlePrompt = (element) ->
config = element.data 'prompt'
@pathawks
pathawks / meta.html
Last active May 20, 2020
Open Graph for Jekyll
View meta.html
{% if include.content %}
<meta property="{{ include.property }}" content="{{ include.content }}" />
{% endif %}
@taizooo
taizooo / hoge.markdown
Created Dec 22, 2009
gist で markdown 記法がつかえる。
View hoge.markdown

#なんだかんだ

##えーと1 どういうこういう そういうどういう

##えーと2 どういうこういう そういうどういう