Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Myat Min Han mmhan

View GitHub Profile
@mmhan
mmhan / reform_simple_form.rb
Created Aug 21, 2020
Reform and Form Helper workaround
View reform_simple_form.rb
# concepts/thing/contract/contract.rb
require 'disposable/twin/property/hash'
module Thing::Contract
class Contract < Reform::Form
include Disposable::Twin::Property::Hash
property :data, field: :hash do
property :foo_bar
@mmhan
mmhan / merge_vs_assign.rb
Last active Apr 5, 2017
Ruby's hash `merge!` vs `[]`
View merge_vs_assign.rb
require "benchmark"
n = 100_000
Benchmark.bm(7) do |x|
x.report("merge! : ") do
a = {}
n.times { |i| a.merge! i => "1" }
end
View complexConstructor.java
// simple constructor
//
private final int x;
private final int y;
private final String z;
public MyClass(int x, int y, String z) {
this.x = x;
this.y = y;
this.z = z;
View person.rb
class Person
@@klass_name = "Person"
def initialize(name)
@name = name
end
def self.klass_name
@@klass_name
end
View Manual.md

General

  • WPM > 40
    • typing.io
  • Typo-less, par grammar
  • Soft Tab, 2 spaces.
    • Sublime -
    • Vim -
    • Android Studio 0-
    • XCode -
View redlink_diagnostic.md
View feeds.sh
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: <skey>' \
http://localhost:3000/feed/<epoch>
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: <skey>' \
http://localhost:3000/feed/0
View test2.sh
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: SNIT_SESSION_KEY' \
http://<api_url>/feed/mine
View test.sh
curl -X POST \
--header 'Content-Type: application/json' \
-d '{"ph":"0912345678","nick":"","name":"Thar Htet","email":"bla@gmail.com","pwd":"12345678"}' \
http://localhost:3000/sign_up
View gist:8930152
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in.
sleep_in(False, False) → True
sleep_in(True, False) → False
sleep_in(False, True) → True
You can’t perform that action at this time.