Skip to content

Instantly share code, notes, and snippets.

@icai
icai / gemjson
Created June 7, 2014 09:21
bundle install log
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.9
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
@icai
icai / clearMenus
Created June 24, 2014 03:36
bootstrap dropdown submenu
function clearMenus() {
$(backdrop).remove()
$(toggle).each(function (e) {
var $parent = getParent($(this))
if (!$parent.hasClass('open')) return
$parent.trigger(e = $.Event('hide.bs.dropdown'))
if (e.isDefaultPrevented()) return
// Remove the following line of code for support of multi-level menus
//$parent.removeClass('open').trigger('hidden.bs.dropdown')
})
@icai
icai / Backbone.View.inject
Created July 31, 2014 01:55
Backbone.View.inject
Backbone.View.prototype.inject = function(viewOptions,options){
var offcialViewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
viewOptions = _.filter(viewOptions,function(item){
return !~_.indexOf(offcialViewOptions,item)
})
_.extend(this, _.pick(options, viewOptions));
}
// view.inject(['modal'],{modal:modal}) demo
@icai
icai / 0_reuse_code.js
Last active August 29, 2015 14:09
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
@icai
icai / serverRespCode
Created November 27, 2014 16:01
server responsive code
100: "Continue",
101: "Switching Protocols",
102: "Processing",
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
206: "Partial Content",
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@icai
icai / simulateloading.js
Created August 18, 2016 07:53
simulated Loading, trigger favicon loading
var oldDone = Nprogress.done;
Nprogress.done = function(){
var setfmSrc = function(dom, url){
dom.src = url;
};
var fm = document.getElementById('triggerloading');
var url = "/favicon.ico"; // ping page;
if(fm){
setfmSrc(fm, url);
} else{
@icai
icai / easing.js
Last active June 14, 2019 00:32
easing easeOutIn effect
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
(function() {
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings = {};
$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
@icai
icai / datepicker.js
Created October 11, 2016 06:15
vue 2 directive with jqueryui
Vue.directive('datepicker', {
bind: function (el, binding, vnode, oldVnode) {
$(el).datepicker({
onSelect: function (date) {
vnode.context.date = date;
}
});
},
update: function (el, binding, vnode, oldVnode) {
$(el).datepicker('setDate', binding.value);
<Row gutter="30">
<Col span="16" v-if="goodscm3Toggle">
<Form-item label="体积(长宽高):" prop="goodscm3" vtype="int" >
<Row gutter="10">
<Col span="7">
<Input v-model="deliveryData.goodsLength" placeholder="长"></Input>
</Col>
<Col span="7">
<Input v-model="deliveryData.goodsWidth" placeholder="宽"></Input>
</Col>