Skip to content

Instantly share code, notes, and snippets.

View carloscabo's full-sized avatar
🏠
Working 100% remotely since 2018

Carlos Cabo carloscabo

🏠
Working 100% remotely since 2018
View GitHub Profile
// Paste into Firebug or Chrome Dev Tools console
// when viewing a page with multiple checkboxes.
(function(d) {
var input = d.getElementsByTagName('input');
var i = input.length;
while (i--) {
if (input[i].type === 'checkbox') {
input[i].setAttribute('checked', 'checked');
<!DOCTYPE html>
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
<!--[if lt IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="<%= ::I18n.locale %>" class="no-js"> <!--<![endif]-->
@carloscabo
carloscabo / _tipography.scss
Created June 6, 2013 11:25
Dynamic font SASS mixin
@mixin font-face($font-family, $file-path, $weight: normal, $style: normal) {
@font-face {
font-family: $font-family;
font-weight: $weight;
font-style: $style;
src: font-url('#{$file-path}.eot');
src: font-url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
font-url('#{$file-path}.woff') format('woff'),
font-url('#{$file-path}.ttf') format('truetype'),
font-url('#{$file-path}.svg##{$font-family}') format('svg');
@carloscabo
carloscabo / jquery.fn.js
Created June 11, 2013 14:59 — forked from afgomez/jquery.fn.js
Generic JQuery plugin template
(function($) {
$.fn.plugin = function() {
return this.each(function() {
var $this = $( this );
if ( !$this.data('plugin') ) {
$this.data( 'plugin', new Plugin(this) );
}
});
}
/* Send a form with a link with data-form="#form_id"
/ You can define params="name,value name,value"
/ All params will be append to the form as hidden inputs before send it
*/
$('body').on('click', '[data-form]', function(e) {
e.preventDefault();
var el = $(this),
form = $(el.data('form')),
params;
/**
* ios7bottom
*
* Listen to changes in safari window size to ensure the position:fixed
* elements are always visible.
*
* Usage
*
* $('#toolbar').ios7bottom();
*/

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
root = "/fullpath/your_project/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.error.log"
stdout_path "#{root}/log/unicorn.log"
listen 8080
worker_processes 2
timeout 30
@mixin ie() {
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
@content;
}
}