Skip to content

Instantly share code, notes, and snippets.

@pi-chan
pi-chan / screenshots.rb
Created June 8, 2016 12:24
4.7inchの画像から無理矢理全サイズひねり出すスクリプト
targets = {
'3.5' => '540x960 -bordercolor "#F5F5F5" -border 50x0',
'4.0' => '640x1136!',
'4.7' => '750x1334!',
'5.5' => '1242x2208!'
}
targets.each do |k, v|
(1..4).each do |i|
system "mkdir #{k}inch"
@kiyoaki
kiyoaki / AssetBundleNameGenerator.cs
Created May 21, 2015 03:24
How to set AssetBundleName from editor scripts.
public class AssetBundleNameGenerator
{
[MenuItem("AssetBundles/Set XXX")]
public static void SetXXX()
{
foreach (var file in Directory
.GetFiles("Assets/XXX/XXX/",
"*.xxx", SearchOption.TopDirectoryOnly))
{
var importer = AssetImporter.GetAtPath(file);
@kishikawakatsumi
kishikawakatsumi / main.m
Created January 14, 2014 18:52
One-line fix for UITextView on iOS 7
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"UIDisableLegacyTextView"];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
@kazuhisa
kazuhisa / relation_patch.rb
Created September 11, 2013 14:57
Rails4.0.0でJoinしたテーブルに対してreadonly(false)が効かないのはバグです。4.1系で解消されるはずなので、次のパッチをconfig/initializersにでも入れておくといいよ。
# -*- coding: utf-8 -*-
module ActiveRecord
class Relation
def initialize(klass, table, values = {})
@klass = klass
@table = table
@values = values
@loaded = false
end
@mattclar
mattclar / simple_form.rb
Last active December 21, 2015 13:58 — forked from tommarshall/simple_form.rb
this is a simple form initializer that is ALMOST compatible with Bootstrap3 apart from a way to set the class of the label this would work perfectly
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
@mataki
mataki / user.rb
Last active December 19, 2015 09:19
mailchimp sync sample
class User < ActiveRecord::Base
def subscribe_mailchimp_list(client = Gibbon.new)
if ENV["MAILCHIMP_LIST_ID"]
logger.info "add #{self.email} to list #{ENV["MAILCHIMP_LIST_ID"]}"
client.list_subscribe(id: ENV["MAILCHIMP_LIST_ID"],
email_address: self.email,
double_optin: false,
send_welcome: false,
update_existing: true,
merge_vers: {:FNAME => self.first_name,
@patorash
patorash / PatorashRailscast.icls
Created April 18, 2013 01:59
/Users/******/Library/Preferences/RubyMine50/colors に設置すればいいのかな?
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="PatorashRailscast" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="EDITOR_FONT_NAME" value="Menlo" />
<colors>
<option name="CARET_COLOR" value="ffffff" />
<option name="CARET_ROW_COLOR" value="333435" />
<option name="CONSOLE_BACKGROUND_KEY" value="2b2b2b" />
<option name="GUTTER_BACKGROUND" value="2b2b2b" />

2013 年の新卒研修メニュー

Rails Tutorial

目的

  • 2013 年で Web アプリケーションを作る時にモダンな方法で一通り Web アプリケーションを自分一人で作れるようになってもらう
  • 作る過程で Web 開発で必要とされるスキルセットを身につけてもらう

教材と教える項目

@authorNari
authorNari / gist:4083386
Created November 16, 2012 02:25
Top of Rubyist決定戦の回答: 再帰メモ化
N=10000
M=3
# 再帰・全探索
# i = 残りの数値
# j = 組み合わせ数
# 4 1 = 1
# 4 2 = 4 1 + (2 2 = 2 1 + (0 2 = 1) = 2) = 3
# 4 3 = ...
# O(2**n)?
@jugyo
jugyo / to_factory_girl.rb
Created November 7, 2012 05:54
ActiveRecord extension to print FactoryGirl definition!
class ActiveRecord::Base
# Usage:
#
# > puts User.first.to_factory_girl
# FactoryGirl.define do
# factory :user do
# ...
# end
# end
# # Usage: FactoryGirl.create(:user, ...)