Skip to content

Instantly share code, notes, and snippets.

View gasolin's full-sized avatar

gasolin gasolin

View GitHub Profile
@gasolin
gasolin / git_stash.sh
Created July 9, 2014 07:29
git stash
# temp save git change
git stash
# list stashed items
git stash list
# get back
git stash pop
# get specify version back
git stash apply stash@{1}
@gasolin
gasolin / push_try
Created August 15, 2014 07:08
How to push to try server
Prepare
edit ~/.hgrc like this:
[ui]
username=Name <your@email>
[extensions]
hgext.mq =
[diff]
@gasolin
gasolin / todo_gaia.js
Created October 13, 2014 13:45
SPA todo app
/**
* Main entry point.
*
* the DOM has been localized and the user sees it in their language.
*
* @class Main
*/
(function() {
'use strict';
@gasolin
gasolin / todo_handleEvent
Created October 14, 2014 01:37
SPA todo app II
/**
* Main entry point.
*
* the DOM has been localized and the user sees it in their language.
*
* @class Main
*/
(function() {
'use strict';
@gasolin
gasolin / task_flux.js
Last active August 29, 2015 14:07
SPA todo app III, not handle db parts yet
/**
* Take Flux concept
*
* the DOM has been localized and the user sees it in their language.
*
* @class Main
*/
(function(exports) {
'use strict';
document.getHTML = function(who){
var txt, ax, el= document.createElement("div");
el.appendChild(who.cloneNode(false));
txt= el.innerHTML;
ax= txt.indexOf('>')+1;
txt= txt.substring(0, ax)+who.innerHTML+ txt.substring(ax);
el= null;
return txt.replace(/>/g,'>\n');
}
/* original link http://blog.gasolin.idv.tw/2014/11/flux-javascript.html */
// Renderer.js
var ClickRenderer = {
init: function s_init(element, Store) {
this.element = element;
this.store = Store;
window.addEventListener('render_view1', this);
},
handleEvent: s_handleEvent(evt) {
@gasolin
gasolin / apply_patch.sh
Created January 26, 2015 06:38
apply/reverse patch from PR
# apply patch from PR
$ curl https://github.com/mozilla-b2g/gaia/pull/12345.patch | git apply
# reverse patch from PR, R is for reverse
$ curl https://github.com/mozilla-b2g/gaia/pull/12345.patch | git apply -R
@gasolin
gasolin / gist:cf5d494c2cc56313c3fe
Created April 14, 2015 16:42
fix gulp reference
https://github.com/gulpjs/gulp/issues/873
@gasolin
gasolin / unselectable
Created April 16, 2015 02:49
user not selectable in browser
.unselectable {
-webkit-touch-callout:none;
-webkit-user-select: none;
-khtml-user-select:none;
-moz-user-select: none;
-ms-user-select: none;
user-select:none;
}