Skip to content

Instantly share code, notes, and snippets.


Wei Sun saga

View GitHub Profile
saga / React-Hooks.js
Created Sep 25, 2020 — forked from craigtaub/React-Hooks.js
Nested React Hooks
View React-Hooks.js
// Engine
const React = {
index: 0,
state: [],
useEffect: (callback, dependencies) => {
const cachedIndex = React.index;
const hasChanged = dependencies !== React.state[cachedIndex];
if (dependencies === undefined || hasChanged) {
View 英文字幕单词提示.py
#!/usr/bin/env python
# coding: utf-8
import pysubs2
import re
from stardict import DictCsv
# depend on
saga / keyup_event.js
Created Jan 29, 2019 — forked from sukima/keyup_event.js
This is how I managed to facilitate keyboard events in multiple browsers
View keyup_event.js
// <input id="my-input-element" type="text" value="foo"/>
var evt, node = document.getElementById('my-input-element');
// Have to use dispatchEvent/fireEvent because jQuery.trigger will not
// fire an event attached via addEventListener. Each environment has an
// unusual way to trigger a keyup event.
if (node.dispatchEvent) {
// Sane browsers
try {
// Chrome, Safari, Firefox
View Free O'Reilly

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x should do it)
  3. Run ./ and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
View setting.js
// Controls the font family.
"editor.fontFamily": "Fira Code Light, Consolas, monospace",
"http.proxy": "",
"window.restoreWindows": "none",
"editor.fontSize": 15,
"editor.accessibilitySupport": "off",
"editor.tabCompletion": true,
saga / UserValidator.cs
Created Sep 13, 2017 — forked from GrantByrne/UserValidator.cs
Using Fluent Validation with WPF - Dead Simple
View UserValidator.cs
using System.Text.RegularExpressions;
using FluentValidation;
using WpfFluentValidationExample.ViewModels;
namespace WpfFluentValidationExample.Lib
public class UserValidator : AbstractValidator<UserViewModel>
public UserValidator()
saga /
Created Jul 26, 2016 — forked from madebyjazz/
Compile all Python scripts into single StdLib.dll .NET assembly
# Script below is based on following post:
# IronPython: EXE compiled using cannot import module "os" - Stack Overflow
import sys
import clr
saga /
Created Mar 25, 2016 — forked from sbaer/
shapeways sample
"""Sample script that accesses the shapeways API
import wsdlprovider
wsdl_url = ""
username = "username"
password = "password"
application_id = "rhinotest"
saga / index.js
Created Feb 26, 2016 — forked from maxogden/index.js
requirebin sketch
View index.js
var graph = require('ngraph.generators').noLinks(142);
var clickMe = document.createElement('h1')
clickMe.setAttribute('style', 'font-family: Helvetica, Arial; font-weight: 200; text-align: center; margin-top: 150px;')
clickMe.innerHTML = 'CLICK ME'
var svg = require('ngraph.vivasvg')(graph);
svg.nodeTemplate("<circle r='5' fill='{{node.color}}'></circle>");