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
void main() { | |
var list = [1, 2, 3]; | |
print(list.reversed); | |
print(list.reversed.runtimeType); | |
print(list); | |
} |
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
error_highlight |
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
hash_instance_methods = %w( | |
< | |
<= | |
== | |
=== | |
> | |
>= | |
[] | |
[]= | |
assoc |
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
# Current.time = Time.current | |
# Current.user = User.find(42) | |
# MyAPIClient.new.analyze | |
class MyAPIClient | |
URL = 'http://api.example.com' | |
def analyze | |
response = Faraday.post(URL, body_hash.to_json, headers) | |
JSON.parse(response.body) |
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
Hash.class_eval do | |
if respond_to? :deep_camelize_keys | |
fail "deep_camelize_keys is already defined" | |
else | |
def deep_camelize_keys(first_letter = :upper) | |
deep_transform_keys { |key| key.to_s.camelize(first_letter) } | |
end | |
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
/mastodon # bin/rails routes | |
Prefix Verb URI Pattern Controller#Action | |
sidekiq /sidekiq Sidekiq::Web | |
pghero /pghero PgHero::Engine | |
GET /oauth/authorize/:code(.:format) oauth/authorizations#show | |
oauth_authorization GET /oauth/authorize(.:format) oauth/authorizations#new | |
DELETE /oauth/authorize(.:format) oauth/authorizations#destroy | |
POST /oauth/authorize(.:format) oauth/authorizations#create | |
oauth_token POST /oauth/token(.:format) doorkeeper/tokens#create | |
oauth_revoke POST /oauth/revoke( |
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 ClientEvents { | |
static connect() { | |
logger.info({ event: 'connect' }); | |
} | |
static reconnect_error(error) { | |
logger.info({ event: 'reconnect_error', error: error }); | |
} | |
} |
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 ApplicationRecord | |
def self.all | |
s = Struct.new(:code, :v) | |
[s.new(42, "hoge"), s.new(43, "fuga")] | |
end | |
end | |
ApplicationRecord.singleton_class.class_eval do | |
def CachedRecords(key: :id) | |
Module.new do |
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 'sshkit' | |
require 'sshkit/dsl' | |
include SSHKit::DSL | |
on 'freeza@freeza.aiming-inc.biz' do | |
puts capture(:ls, '-l') | |
end | |
# total 12 |
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
source 'https://rubygems.org' | |
gem 'rails', '~> 4.2.0' | |
gem 'rails-i18n' | |
gem 'mysql2' | |
gem 'fluent-logger' | |
gem 'rack-oauth2' | |
gem 'twitter' | |
gem 'koala', '~> 1.11' | |
gem 'airbrake', '~> 4.1' |
NewerOlder