This file contains hidden or 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
| module Extension::ActiveRecordExtension | |
| extend ActiveSupport::Concern | |
| included do | |
| # (参考) | |
| # OR operator in WHERE clause with Arel in Rails 4.2 | |
| # http://stackoverflow.com/questions/27627390/or-operator-in-where-clause-with-arel-in-rails-4-2 | |
| # | |
| # ActiveRecord::QueryMethods::WhereChain | |
| # https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/relation/query_methods.rb |
This file contains hidden or 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
| module ArrayExtention | |
| def reject_if(&block) | |
| rejected = [] | |
| delete_if do |value| | |
| if block.call(value) # or if yield | |
| rejected << value | |
| true # なくてもいいけど僕の好み的に明示的に true を返したかった。 | |
| end | |
| end |
This file contains hidden or 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
| calc_rems = fn (n) -> {rem(n, 3), rem(n, 5), n} end | |
| fizzbuzz = fn | |
| {0, 0, _} -> "FizzBuzz" | |
| {0, _, _} -> "Fizz" | |
| {_, 0, _} -> "Buzz" | |
| {_, _, n} -> n | |
| end | |
| IO.inspect(1..50 |> Enum.map(calc_rems) |> Enum.map(fizzbuzz)) |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Highlight followers | |
| // @namespace quanon | |
| // @version 0.1 | |
| // @author QUANON | |
| // @match https://twitter.com/following | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or 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
| export PROMPT=$'%{$fg[magenta]%}|%c|*\'-\'\) %{$reset_color%}' | |
| export PROMPT=$'|%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}|*\'-\'\) %(!.#.$) ' |
This file contains hidden or 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 int LED4 = 13; | |
| const int LED3 = 12; | |
| const int LED2 = 11; | |
| const int LED1 = 10; | |
| const int BTN1 = 7; | |
| int old_input = LOW; | |
| int new_input = LOW; | |
| int count = 0; | |
This file contains hidden or 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
| ruby '2.3.0' | |
| source 'https://rubygems.org' | |
| gem 'rails', '~> 5.0.0.beta2' |
This file contains hidden or 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
| # enum 定義の後で include すること。 | |
| module EnumValueGetter | |
| extend ActiveSupport::Concern | |
| included do | |
| defined_enums.keys.each do |name| | |
| define_method("#{name}_value") { self[name] } | |
| end | |
| end | |
| end |
This file contains hidden or 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
| var page = require('webpage').create(); | |
| var args = require('system').args; | |
| page.viewportSize = { | |
| width: 1200, | |
| height: 780 | |
| }; | |
| page.open(args[1], function (status) { | |
| if (status !== 'success') { |
This file contains hidden or 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
| # ~/.config/fish/config.fish | |
| ## peco ## | |
| function fish_user_key_bindings | |
| bind \cr peco_select_history | |
| end | |
| ## rbenv ## | |
| set -x PATH $HOME/.rbenv/bin $PATH | |
| rbenv init - | source |