Skip to content

Instantly share code, notes, and snippets.

View yothinix's full-sized avatar

Yothin M yothinix

View GitHub Profile
$ iex -S mix main
Erlang/OTP 21 [erts-10.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Request to pry #PID<0.99.0> at Mssum.main/0 (lib/mssum.ex:16)
14:
15: select_issue_fields = fn issue -> Map.take(issue, @issue_field) end
16: require IEx; IEx.pry
17: issues =
18: milestone
Allow? [Yn] y
Interactive Elixir (1.6.6) - press Ctrl+C to exit (type h() ENTER for help)
@yothinix
yothinix / init.vim
Created May 22, 2018 02:51
Yothinix's init.vim setup
if &compatible
set nocompatible
endif
set runtimepath+=/Users/man/.nvim/bundles/repos/github.com/Shougo/dein.vim
if dein#load_state('/Users/man/.nvim/bundles')
call dein#begin('/Users/man/.nvim/bundles')
call dein#add('/Users/man/.nvim/bundles/repos/github.com/Shougo/dein.vim')
from verbose_dataclasses import dataclass, field
from datatime import datetime
@dataclass(order=True, unsafe_hash=True)
class Employee:
emp_id: int = field()
name: str = field()
gender: str = field()
salary: int = field(hash=False, repr=False, metadata={'units': 'bitcoin'})
age: int = field(hash=False)
from dataclasses import dataclass
@dataclass
class Color:
hue: int
saturation: float
lightness: float = 0.5 # default value
from typing import cast
possible_values = function_return_possible_values()
new_type = cast(new_type, possible_values)
def f(l: List[str]) -> None:
s = l.pop() # reveal_type(s) -> str
def g(message: str = None) -> None:
if message is None:
return
reveal_type(message) # -> str
from typing import Type
def do_something(t: Type[SomeClass]) -> SomeClass:
...
from typing import NewType
USERID = NewType('USERID', int)
def get_username(id: USERID) -> str:
...
from typing import TypeVar
T = TypeVar('T')
def f(s: T) -> T:
...
from typing import Union
def f(s: Union[int, str]) -> None:
...