Skip to content

Instantly share code, notes, and snippets.

View cloudchen's full-sized avatar

Cloud Chen cloudchen

  • Shanghai, China
  • 23:47 (UTC +08:00)
View GitHub Profile
@thecodedrift
thecodedrift / amd.js
Last active February 11, 2024 22:31
Shim your AMD
/*
================================================================================
ABOUT THIS FILE - amd shim https://gist.github.com/Jakobo/6894733
================================================================================
This file is a helper shim for pure AMD modules. When writing an AMD module,
you need to have access to a global "define" method. This creates a global
define(), a global require(), and a global AMD object.
define/require work like proper sinon stubs. Any define() calls that happen
before your test are automatically queued to run. You can then stub out
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
anonymous
anonymous / dict-ie.js
Created December 28, 2012 07:12
old IE shim for creating empty dict objects
// pre-ES5 IE version
var dict = (function() {
var PROPERTY_KEYS = [
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable"
"valueOf",
"toString",
"toLocaleString",
"constructor"
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
@jonathantneal
jonathantneal / ie-currentStyle-without-reflow.js
Created November 9, 2011 21:02
ie-currentStyle-without-reflow.js
(function (doc) {
var docEl = document.documentElement;
// get current style
window.getCurrentStyle = function (node) {
if (!node || !node.nodeName) return;
var docElClone = docEl.cloneNode(true), a, l, i;
for (a = docEl.getElementsByTagName(node.nodeName), l = a.length, i = 0; a[i] !== node; ++i);
return docElClone.getElementsByTagName(node.nodeName)[i].currentStyle;
};
})(document);
@skanev
skanev / close_hidden_buffers.vim
Created July 6, 2011 20:15
Close all hidden buffers in Vim
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
function! s:CloseHiddenBuffers()
let open_buffers = []
for i in range(tabpagenr('$'))
call extend(open_buffers, tabpagebuflist(i + 1))
endfor
for num in range(1, bufnr("$") + 1)
if buflisted(num) && index(open_buffers, num) == -1
@jeresig
jeresig / .vimrc
Created May 4, 2011 16:46
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
set tabline=%!SetTabLine()
function! SetTabLine()
" NOTE: left/right padding of each tab was hard coded as 1 space.
" NOTE: require Vim 7.3 strwidth() to display fullwidth text correctly.
" settings
let tabMinWidth = 0
let tabMaxWidth = 40
let tabMinWidthResized = 15