Skip to content

Instantly share code, notes, and snippets.

View lanqy's full-sized avatar
🎯
Focusing

Lan Qingyong lanqy

🎯
Focusing
  • Shenzhen,China
View GitHub Profile
@dexteryy
dexteryy / standards_for_webapps_on_mobile.md
Last active August 17, 2017 02:16
W3C Standards for Web Apps on Mobile (After HTML5)
@broerjuang
broerjuang / thinkingInReact.re
Created February 9, 2018 18:39
This is the implementation of thinking in react using reason
type product = {
category: string,
price: string,
stocked: bool,
name: string
};
type products = list(product);
let products = [
@Zerim
Zerim / SignupForm.re
Last active February 19, 2018 23:25
A simple SignupForm written in ReasonML
/* `action` and `state` types must be defined before the `let component` statement for type inference to work */
type action =
| UpdateEmail string
| UpdatePassword string;
type state = {
email: string,
password: string
};
@ChrisCinelli
ChrisCinelli / gist:2051841
Created March 16, 2012 18:57
Logging of Javascript error on the Frontend to the Backend
/* ==========================================================
*
* Log on a remote server most of the errors in the browser
*
* @author Chris Cinelli
*
* Depends on:
* stacktrace.js - https://github.com/eriwen/javascript-stacktrace
* jsonStringify.js - http://www.thomasfrank.se/json_stringify_revisited.html
*
@paullewis
paullewis / gist:1981455
Created March 5, 2012 22:03
Quicksort in JavaScript
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
@alex35mil
alex35mil / 1-styles.css
Created April 18, 2017 06:41
CSS Modules + PostCSS + Webpack
:root {
--my-width: 400px;
}
:export {
myWidth: var(--my-width);
}
.myClass {
width: var(--my-width);
@busypeoples
busypeoples / FormExample.re
Created April 23, 2018 00:20
Form Example in ReasonML
type validation('a) =
| NotEmpty
| Custom('a);
type t = string;
let validate = (rule, value, values) =>
switch (rule) {
| NotEmpty => String.length(value) > 0
| Custom(fn) => fn(value, values)
@gaearon
gaearon / ReduxMicroBoilerplate.js
Last active March 26, 2020 00:35
Super minimal React + Redux app
import React, { Component } from 'react';
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux';
import { provide, connect } from 'react-redux';
import thunk from 'redux-thunk';
const AVAILABLE_SUBREDDITS = ['apple', 'pics'];
// ------------
// reducers
// ------------
@jaredly
jaredly / BasicServer.re
Created January 2, 2018 05:24
Simple Static File Server in Reason/OCaml
let recv = (client, maxlen) => {
let bytes = Bytes.create(maxlen);
let len = Unix.recv(client, bytes, 0, maxlen, []);
Bytes.sub_string(bytes, 0, len)
};
let parse_top = top => {
let parts = Str.split(Str.regexp("[ \t]+"), top);
switch (parts) {
module Store = {
type action =
| Increase
| Decrease
| SetUsername(string);
type state = {
count: int,
username: string,
};
type storeBag = {