Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

sunfy sfengyuan

🎯
Focusing
  • 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
{"lastUpload":"2020-03-09T14:58:32.697Z","extensionVersion":"v3.4.3"}
View pat.rb
# frozen_string_literal: true
# https://pintia.cn/problem-sets/17/problems/260
# input example: 19 *
# output example:
# *****
# ***
# *
# ***
# *****
@sfengyuan
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": [
[
"env",
{"modules": false}
],
["stage-3"]
],
"plugins": ["transform-runtime"],
"env": {
@sfengyuan
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
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
sfengyuan / .gitignore
Created Oct 20, 2017
gitignore for frontend project
View .gitignore
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
*.cache
# dependencies
node_modules
View numbers.js
function round(value, decimals) {
return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
}
//round(1.005, 2);
// 1.01
@sfengyuan
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\""