Skip to content

Instantly share code, notes, and snippets.

@impressiver
impressiver / raven-config.html
Last active February 27, 2024 14:27
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@josephj
josephj / mask.scss
Created October 19, 2012 02:50
A pure CSS mask which centralizes content inside. ( http://josephj.com/lab/2012/mask/demo.html )
@import "compass";
/**
* A pure CSS mask which centralizes content inside.
* This technique is compatible with IE7+ and major standard browsers.
*
* Required HTML structure:
*
* <div class="mask">
* <div class="mask-box">
* <div class="mask-inner-box">
@sunvisor
sunvisor / jsdoc.vim
Created October 17, 2012 04:54
insert jsdoc style comment. (vim function)
" JSDoc形式のコメントを追加(functionの行で実行する)
" hogeFunc: function() の形式と function hogeFunc() に対応
" 関数定義でない場合は、コメントだけ出力する
function! AddJSDoc()
let l:jsDocregex = '\s*\([a-zA-Z]*\)\s*[:=]\s*function\s*(\s*\(.*\)\s*).*'
let l:jsDocregex2 = '\s*function \([a-zA-Z]*\)\s*(\s*\(.*\)\s*).*'
let l:line = getline('.')
let l:indent = indent('.')
let l:space = repeat(" ", l:indent)
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@necolas
necolas / _todo.md
Created June 30, 2012 18:07
Grunt tasks to process HTML files and produce a deploy directory of optimized files
  • Avoid reprocessing the same block in different HTML files.
  • Throw warning when processing a different block to an existing destination file. Hashing will avoid collisions, but introduce confusion.
  • Add file versioning for inline media and CSS images.
  • Avoid need for 'usemin' task - get the replacement element pattern from the first/last HTML element in actual block being replaced. Added benefit of preserving other attributes that may exist (e.g. title, media).

Acknowledgements: This is an adaption of some of Mickael Daniel's work on h5bp/node-build-script

@eikes
eikes / getElementsByClassName.polyfill.js
Created April 4, 2012 08:04
Polyfill for getElementsByClassName
// Add a getElementsByClassName function if the browser doesn't have one
// Limitation: only works with one class name
// Copyright: Eike Send http://eike.se/nd
// License: MIT License
if (!document.getElementsByClassName) {
document.getElementsByClassName = function(search) {
var d = document, elements, pattern, i, results = [];
if (d.querySelectorAll) { // IE8
return d.querySelectorAll("." + search);
@davidmfoley
davidmfoley / coffeelint.vim
Created April 2, 2012 14:07
coffeelint/vim quickfix integration
" Get coffeelint errors in the vim quickfix menu
" requires coffeelint to be installed and in the path
" http://www.coffeelint.org/
" lint the current file
function! CoffeeLintFile()
let current = fnamemodify(expand("%"), ':p')
call CoffeeLintAnalyze(current)
endfunction
@Raynos
Raynos / file.js
Created November 30, 2011 15:27
Recursive fs.watch
fs.readdir(srcPath, handleDirectoryRead.bind(null, srcPath));
function handleDirectoryRead(srcPath, err, files) {
files.forEach(handleFile.bind(null, srcPath));
}
function handleFile(srcPath, file) {
var uri = path.join(srcPath, file);
fs.stat(uri, handleStat.bind(null, uri));
}
@josephj
josephj / debugging.js
Created November 28, 2011 03:51
Remove unecessary JavaScript logs, for debugging purpose.
YUI_config = {
logInclude : {
"ID3": true
}
};
if (typeof console !== "undefined") {
console.log = function (m, t, s) {
s = s || null;
if (!s) {
return false;
@chriseppstein
chriseppstein / readme.md
Created August 31, 2011 21:57 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline

This gist is no longer valid. Please see Compass-Rails for instructions on how to install.