Skip to content

Instantly share code, notes, and snippets.

View yosriady's full-sized avatar
💡
Optimize for Learning

Yos Riady yosriady

💡
Optimize for Learning
View GitHub Profile
@yosriady
yosriady / .bash_prompt
Last active June 6, 2016 07:01
Bash prompt
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
fi
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
MAGENTA=$(tput setaf 9)
ORANGE=$(tput setaf 172)
GREEN=$(tput setaf 190)
[alias]
a = add . -A
st = status
cl = clone
ci = commit
c = commit -m
ca = commit --amend
br = branch
co = checkout
df = diff --word-diff
@yosriady
yosriady / component.ex
Last active January 11, 2017 10:10
Entity Component System in Elixir
# A component is a minimal data object needed for a specific purpose.
# A component has no behaviour.
# A component class validates a given configuration and creates run-time data structures.
# Implemented as an Elixir Agent!
defmodule Component
@type options :: [key: type]
# Functions that have to be implemented by Components (if any)
@callback new(options) :: struct()
@yosriady
yosriady / README.md
Last active September 5, 2016 05:19
NUS Hackers Talk Application

Talk Title:

Entity Component Systems in Elixir

Talk Description:

Entity-Component-System (ECS) is a distributed and compositional architectural design pattern that is mostly used in game development. Elixir is a dynamic, functional language built on top of the Erlang VM designed for building scalable and maintainable applications. In this talk, discover how we can use both ECS and Elixir in a novel approach to structure our programs beyond the traditional OO/inheritance paradigm. We'll cover:

Keybase proof

I hereby claim:

  • I am yosriady on github.
  • I am yos (https://keybase.io/yos) on keybase.
  • I have a public key whose fingerprint is 4878 0825 CF03 CC90 FF13 624A EFCE 375C 3DFC DBDD

To claim this, I am signing this object:

@yosriady
yosriady / README.md
Last active September 21, 2016 09:22
NUS Hackers Talk Proposal

Talk Title:

GraphQL in an Age of REST

Talk Description:

GraphQL is an application layer query language from Facebook. With GraphQL, you can define your backend as a well-defined graph-based schema. Then client applications can query your dataset as they are needed. GraphQL’s power comes from a simple idea — instead of defining the structure of responses on the server, the flexibility is given to the client. In this talk, discover a new approach to build and expose Web APIs. Will GraphQL do to REST what REST did to SOAP?

Knowledge has a half-life. You should apply it, or it expires. Either we forget, or that knowledge becomes obsolete. Knowing something matters less than doing something consistently.

pragma solidity ^0.5.4;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
pragma solidity ^0.5.10;
interface ISimpleERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
function mint(address to, uint amount) external;
function balanceOf(address account) external view returns (uint);
function transfer(address to, uint amount) external returns (bool);
}
@yosriady
yosriady / SimpleToken.sol
Last active October 19, 2019 06:27
Sample code for 'Getting Started with Smart Contracts' talk at geekcamp.sg
pragma solidity ^0.5.11;
contract SimpleToken {
string public constant name = "GeekCamp Token";
string public constant symbol = "GEEK";
uint8 public constant decimals = 0;
address public minter;
mapping (address => uint) private _balances;