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
| if (C) | |
| { | |
| if (c) | |
| { | |
| if (a) | |
| { | |
| return "<link type=\"text/css\" rel=\"preload\" href=\"https://cdn.no{0}\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\" /><noscript><link rel = \"stylesheet\" href=\"https://cdn | |
| .no{0}\"></noscript>"; | |
| } | |
| else |
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
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem 'rack-contrib' | |
| gem 'sinatra' | |
| gem 'shotgun' | |
| gem "sinatra-param", require: "sinatra/param" | |
| gem 'sinatra-contrib' |
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
| class A | |
| def initialize() | |
| @a = 1 | |
| end | |
| end | |
| a = A.new | |
| a.instance_variable_get(:@a) # 1 | |
| a.instance_variable_set(:@a, 2) |
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
| 'hello'.hello_world # NoMethodError: undefined method `hello_world' for "hello":String | |
| class String | |
| def hello_world | |
| p 'Hello ' + self | |
| end | |
| end | |
| 'hello'.hello_world # "Hello hello" |
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 A | |
| def self.a | |
| p 'self a' | |
| end | |
| def a | |
| p 'Aa' | |
| end | |
| def b |
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
| ERROR: | |
| "error": { | |
| "code": "validation_error", | |
| "description": "Validation failed" | |
| } | |
| "meta": { | |
| "validation_errors": { | |
| "card_number": { |
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
| require 'sinatra' | |
| require 'sinatra/param' | |
| require 'sinatra/json' | |
| set :raise_sinatra_param_exceptions, true | |
| set :show_exceptions, false | |
| get '/hi' do | |
| param :param1, Float, required: true | |
| param :param2, Float, required: true |
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
| ## http://ruby-doc.org/core-2.3.0/Exception.html | |
| begin | |
| p '1' | |
| 1 / 0 | |
| rescue | |
| p '2' | |
| end | |
| # "1" |
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
| ## http://ruby-doc.org/core-2.1.2/Kernel.html | |
| # /Users/tmp/a.rb | |
| p 'Hello' | |
| class A | |
| def hello | |
| p 'Hello' | |
| 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
| A = Class.new do | |
| attr_reader :a | |
| def initialize(a) | |
| @a = a | |
| end | |
| end | |
| a = A.new 1 | |
| a.class.class #class |
NewerOlder