Skip to content

Instantly share code, notes, and snippets.

View SpringMT's full-sized avatar

Spring_MT SpringMT

View GitHub Profile
using System;
class TestA
{
public int publicHoge;
private int privateHoge;
protected int protectedHoge;
void BaseHoge()
{
Makefileの中身
pre-install-rb-default:
$(ECHO) installing default hogehoge libraries
./.RUBYARCHDIR.time:
$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
$(Q) $(TOUCH) $@
こっちの
$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
@SpringMT
SpringMT / gist:9776016
Created March 26, 2014 02:43
activerecord-4.0.4/lib/active_record/core.rb
# Returns the connection currently associated with the class. This can
# also be used to "borrow" the connection to do database work that isn't
# easily done without going straight to SQL.
def connection
ActiveSupport::Deprecation.warn("#connection is deprecated in favour of accessing it via the class")
self.class.connection
end
@SpringMT
SpringMT / gist:9826131
Created March 28, 2014 05:44
エンジニアとして人におしえるために

走り書きだけど

コンセプト

何を教えるべきか

何を教えないべきか

diff --git a/db/migrate/20140426112747_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20140426112747_acts_as_taggable_on_migratio
n.acts_as_taggable_on_engine.rb
index 6bbd559..9d9df73 100644
--- a/db/migrate/20140426112747_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20140426112747_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
@@ -2,7 +2,7 @@
class ActsAsTaggableOnMigration < ActiveRecord::Migration
def self.up
create_table :tags do |t|
- t.string :name
$ codemod -m -d ./app --extensions rb Foo Bar
./app/controllers/hoge_controller.rb:7
def hoge
- foo = Foo.new options
+ foo = BAr.new options
Accept change (y = yes [default], n = no, e = edit, A = yes to all, E = yes+edit)?
irb(main):009:0> f = File.open "./test_test", (File::WRONLY | File::APPEND | File::EXCL)
=> #<File:./test_test>
irb(main):010:0> f.write 123
=> 3
irb(main):011:0> f.write 123
=> 3
ここで./test_testけす
@SpringMT
SpringMT / gist:3682dc54999a1b5ac14f
Created June 2, 2014 05:19
6月の個人タスク
* iOSアプリ(勘助)のを最優先で作る
* Unityは一旦おいて、ちょっと本よむ
* CとC++の勉強
* Unity C#は業務でやる
* rubyのsigdumpだけだとよくわからない、メモリダンプとかもっと調べておく
--- mod_rpaf-2.0.c.orig 2008-01-01 12:05:40.000000000 +0900
+++ mod_rpaf-2.0.c 2012-11-02 00:54:10.541614960 +0900
@@ -139,7 +139,7 @@
int i;
char **list = (char**)proxy_ips->elts;
for (i = 0; i < proxy_ips->nelts; i++) {
- if (strcmp(remote_ip, list[i]) == 0)
+ if (strncmp(remote_ip, list[i], strlen(list[i])) == 0)
return 1;
}
--- Makefile.orig 2007-12-13 12:40:22.000000000 +0900
+++ Makefile 2013-07-22 17:12:40.659570633 +0900
@@ -1,7 +1,7 @@
# Makefile for mod_rpaf.c (gmake)
# $Id: Makefile 16 2007-12-13 03:40:22Z thomas $
APXS=$(shell which apxs)
-APXS2=$(shell which apxs2)
+APXS2=$(shell which apxs)
default: