Skip to content

Instantly share code, notes, and snippets.


sunfy sfengyuan

  • China
View GitHub Profile
View reset.css
/* css reset */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
View cloudSettings
View pat.rb
# frozen_string_literal: true
# input example: 19 *
# output example:
# *****
# ***
# *
# ***
# *****
sfengyuan / keybinding.json.txt
Last active Jan 28, 2019
vs code key bindings
View keybinding.json.txt
// Place your key bindings in this file to overwrite the defaults
// -------- edit
"key": "ctrl+shift+up",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
"key": "ctrl+shift+down",
View .babelrc
"presets": [
{"modules": false}
"plugins": ["transform-runtime"],
"env": {
sfengyuan / insertText.js
Created Dec 19, 2017
Insert text to textarea
View insertText.js
* Insert <text> to <areaId>, then [selectedText] will be selected.
* @export module.insertAtCaret
* @param {string} areaId - ID of textarea
* @param {string} text - text to be inserted
* @param {string} [selectedText=undefined] - a sub string of param <text>,
* will be selected after insertion, and also be replaced by the current selected text in textarea
export function insertAtCaret (areaId, text, selectedText = undefined) {
sfengyuan / sync.bat
Created Dec 19, 2017
Sync sublime text, vs code, cmder with dropbox on windows
View sync.bat
:: Ensure the two sublime text folders are moved into drobox first.
:: Sublime text uses links to work.
mklink /j "D:\Program Files\st3\Data\Packages" "E:\Dropbox\st\Data\Packages"
mklink /j "D:\Program Files\st3\Data\Installed Packages" "E:\Dropbox\st\Data\Installed Packages"
:: Dropbox uses links to sync vs code.
:: In vs code, custom keymap should be done with keybindings.json, otherwise they won't be saved to dropbox.
mklink /j "E:\Dropbox\code\User" "%appdata%\Code\User"
mklink /j "E:\Dropbox\code\.vscode" "%USERPROFILE%\Code\.vscode"
sfengyuan / .gitignore
Created Oct 20, 2017
gitignore for frontend project
View .gitignore
# See for more about ignoring files.
# compiled output
# dependencies
View numbers.js
function round(value, decimals) {
return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
//round(1.005, 2);
// 1.01
sfengyuan / Open with
Last active Apr 8, 2017
Settings on Windows
View Open with
@echo off
SET AppKey=SublimeText3
SET AppTitle= Sublime Text 3
SET AppPath=D:\Program Files\st\sublime_text.exe
SET AppIcon=%AppPath%,0
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /ve /f /d "%AppTitle%"
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%1\""