Skip to content

Instantly share code, notes, and snippets.

View towry's full-sized avatar
🎯
Focusing

Towry Wang towry

🎯
Focusing
View GitHub Profile
@towry
towry / monad_explain.js
Last active July 6, 2017 10:00
explain monad in js.
/*!
https://blog.jcoglan.com/2011/03/05/translation-from-haskell-to-javascript-of-selected-portions-of-the-best-introduction-to-monads-ive-ever-read/
this is a function with side effect, to dealing with side effect,
we can format it into return value, because pure function can only
have input and output (return) effect to outside world.
```js
@towry
towry / request_webpage_in.swift
Created June 21, 2017 01:52
swift: request a web page.
//: Playground - noun: a place where people can play
import Foundation
import PlaygroundSupport
URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
let url = URL(string: "http://www.baidu.com")
let task = URLSession.shared.dataTask(with: url!) {data, response, error in

Keybase proof

I hereby claim:

  • I am towry on github.
  • I am towry (https://keybase.io/towry) on keybase.
  • I have a public key whose fingerprint is B48B 3AEB 954C 5CC4 F323 B0FE E6AA 531E C52D DED3

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
padding-top: 3rem;
}
@towry
towry / build_run_ios_app_in_simulator_from_terminal.md
Created February 28, 2017 07:18
build and run ios app in simulator from terminal command line.
@towry
towry / link.md
Created February 24, 2017 13:48
ios SplitViewController example without storyboard
@towry
towry / README-Template.md
Created February 15, 2017 06:00 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@towry
towry / setup_vpn.md
Last active June 22, 2019 22:06
Installing a vps and setup vpn

Initialize the server.

  1. login as root user.
    • ssh root@server_ip_address
  2. create a new user:
    • adduser username
    • Use the usermod command to add the user to the sudo group. usermod -aG sudo username
    • Test sudo access on new user account. su - username
  3. login as new created user.
@towry
towry / app.js
Last active October 26, 2016 05:01
history api fallback for vue-router
// usage
import historyFallback from 'lib/polyfill/historyFallback'
import historySupport from 'lib/support/history';
let redirected = historyFallback('/', historySupport ? 'history' : 'hash');
if (!redirected) {
// You app ...
// Vue.use(VueRouter);
@towry
towry / lazy-load.js
Created May 24, 2016 02:01
lazy load images.
/*!
* Copyright 2016 MoSeeker, Inc.
* @author Towry Wang
*/
var verge = require('verge');
var classes = require('dom-classes');
var objectAssign = require('object-assign');
function LazyLoad(options) {