Skip to content

Instantly share code, notes, and snippets.

@subchen
subchen / git-stash.md
Created October 31, 2014 08:56
Git Stash 用法

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

这条命令实际上是第一条 git stash 命令的完整版

@subchen
subchen / jetbrick.zIndex.js
Last active August 29, 2015 14:08
获取整个document最大可用的 zIndex
(function(window, jetbrick) {
/**
* 获取整个document最大可用的 zIndex
*
* @returns {Number}
*/
jetbrick.zIndex = function() {
var nodes = window.document.getElementsByTagName("*");
var max = 0;
for (var i = 0; i < nodes.length; i++) {
@subchen
subchen / getCurrentScriptUrl.js
Last active August 29, 2015 14:08
获取 JavaScript 脚本自身的 URL
(function(window, $, jetbrick) {
/**
* Get the current script's URL by throwing an `Error` and analyzing it.
*
* @returns String or `undefined`
* @private
*/
var getCurrentScriptUrlFromErrorStack = function(stack) {
var url, matches;
if (typeof stack === "string" && stack) {
@subchen
subchen / install-chocolatey.md
Last active August 29, 2015 14:08
Install chocolatey for WindowsSee: http://chocolatey.org/

install chocolatey

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

install compoments

@subchen
subchen / css_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@subchen
subchen / javascript_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@subchen
subchen / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@subchen
subchen / check-ruby-encoding.md
Last active August 29, 2015 14:08
Ruby 编码相关

检测当前平台的默认编码

ruby -e 'p __ENCODING__'
ruby -e 'p [Encoding.default_external, Encoding.default_internal]'

修改默认编码为 utf-8

@subchen
subchen / copy-pre-code.html
Last active May 24, 2019 06:31
zero-clipboard demo
<style>
.zero-clipboard {
position: relative;
}
.btn-clipboard {
position: absolute;
top: 0;
right: 0;
z-index: 10;
display: block;
@subchen
subchen / bootstrap3-dropdown-submenu.css
Last active August 29, 2015 14:08
Bootstrap3 添加下拉菜单的子菜单 dropdown-submenu
.dropdown-submenu {
position:relative;
}
.dropdown-submenu > .dropdown-menu {
top:0;
left:100%;
margin-top:-6px;
margin-left:-1px;
-webkit-border-radius:0 6px 6px 6px;
-moz-border-radius:0 6px 6px 6px;