Skip to content

Instantly share code, notes, and snippets.

@ivawzh
ivawzh / .log
Created October 4, 2018 14:54
Javascript singleton in ES6
TCL: -------------------------------------
TCL: main -> db1 === db2 true
TCL: main -> db1 === db3 true
TCL: -------------------------------------
@ivawzh
ivawzh / new-recomposed-component.js
Last active April 13, 2018 12:33
React Class Component VS Recomposed Component
import React from 'react'
import { withStyles } from 'material-ui/styles'
import AppBar from 'material-ui/AppBar'
import Toolbar from 'material-ui/Toolbar'
import Typography from 'material-ui/Typography'
import IconButton from 'material-ui/IconButton'
import Hidden from 'material-ui/Hidden'
import Button from 'material-ui/Button';
import MenuIcon from 'material-ui-icons/Menu'
import Menu, { MenuItem } from 'material-ui/Menu'
@ivawzh
ivawzh / render-promise-in-react.js
Created April 10, 2018 11:03 — forked from hex13/render-promise-in-react.js
how to render promises in React
//License CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/
class Deferred extends React.Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
}
componentDidMount() {
# frozen_string_literal: true
require 'config'
require 'rest-client'
require 'retriable'
require 'contract_repository'
require 'group_contracts_by_agency'
require 'tzinfo'
require 'monitoring'
require 'pp'
@ivawzh
ivawzh / .\.vscode\launch.json
Last active December 8, 2018 13:27
Visual Studio Code settings
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "WebsiteService: Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
@ivawzh
ivawzh / clean_docker.bash
Last active November 18, 2017 03:09
remove all docker images and containers
# remove all docker images and containers
clean_docker () {
docker rm -f $(docker ps -aq)
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
}
@ivawzh
ivawzh / bash.sh
Created October 24, 2017 00:26
clean docker images and containers
clean_docker () {
docker rm -f $(docker ps -aq)
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
}
@ivawzh
ivawzh / login.js
Last active April 18, 2017 02:06
Redux Login Action snippet
// @ redux/actions/login.js
export function loginStart(username, pw): Promise<void> {
return async (dispatch) => {
dispatch({ type: 'LOGIN_START' })
try {
const userData = await login(username, pw)
dispatch(loginSuccess(userData))
} catch (error) {
dispatch(loginFailure(error))
}

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@ivawzh
ivawzh / countries.sql
Created March 26, 2017 15:14 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;