Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / UI link
Last active August 29, 2015 14:01
UI link
@icai
icai / UI link
Created May 8, 2014 07:22
UI link
@icai
icai / html5doctor_ELEMENT_effect
Created April 4, 2014 05:44
html5doctor ELEMENT effect
var links = $("#glossary li a");
links.each(function() {
var linkWidth = $(this).outerWidth();
var canvas = $("<canvas></canvas>");
canvas.attr({width: linkWidth,height: 21});
var context = canvas.get(0).getContext("2d");
// Set up the rounded corners
context.lineWidth = 6;
@icai
icai / Highlight.css
Created January 28, 2014 16:11
Expressjs Highlight style
/* code */
p code {
background: #efefef;
border: 1px solid #eaeaea;
font-family: monaco, monospace;
font-size: .75em;
padding: 2px 8px;
-webkit-border-radius: 3px;
@icai
icai / accessibility
Created January 21, 2014 02:15
about accessibility
#accessibility
###Todo
- input,select,textarea,fieldset -> aria-labelledby="[id]"
- position element -> tabindex="-1"
- focusable -> tabindex="0"
- add `role` attribute
- add `aria-` attribute
@icai
icai / LICENSE.txt
Created June 20, 2013 15:43 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE