Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
# Using GPL v2
# Author:: DongYuwei(mailto:newdongyuwei@gmail.com)
# 更新部分内容应对2010年7月25日飞信升级
require 'uri'
require 'net/http'
require 'net/https'
require "socket"
require 'rexml/document'
@junhuif
junhuif / go
Created December 2, 2015 03:27
Gorm don't insert false value to database for boolean field
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
)
@junhuif
junhuif / gorm-insert-bug-in-boolean-field.go
Created December 2, 2015 03:30
Gorm doesn't insert false value into database for boolean field
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
var DB *gorm.DB
@junhuif
junhuif / index.pug
Created September 25, 2017 10:10
react-redux with immutable instead of pureRenderMixin demo
#root
@junhuif
junhuif / dabblet.css
Created June 30, 2018 05:28
Translucent borders
/**
* Translucent borders
*/
body {
background: url('http://csssecrets.io/images/stone-art.jpg');
}
div {
border: 10px solid hsla(0,0%,100%,.5);
App&
Content
Stores
pick store -> Categories
Categories
pick category -> Product List
back to store list -> Stores
Product List
choose product -> Product
back to categories -> Categories
@junhuif
junhuif / machine.js
Last active December 20, 2019 13:34
Generated by XState Viz: https://xstate.js.org/viz
const submitMachine = Machine(
{
initial: "idle",
context: {
orderCode: "some"
},
states: {
idle: {
on: {
SUBMIT: [
@junhuif
junhuif / machine.js
Last active April 7, 2020 07:30
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@junhuif
junhuif / machine.js
Last active April 7, 2020 06:22
Generated by XState Viz: https://xstate.js.org/viz
const SERVICE_CONFIRM_ORDER_FETCHER = "confirmOrderFetcher";
const ACTION_ON_ORDER_CONFIRMED = "onOrderConfirmed";
const STATE_SUBMITTING = "submitting";
// https://xstate.js.org/viz/?gist=886857c070d6f5a20bc1fd638e99192c
const confirmationMachine = Machine({
id: "confirmation",
initial: "editing",
context: {},
states: {
@junhuif
junhuif / machine.js
Created April 7, 2020 07:33
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions