Skip to content

Instantly share code, notes, and snippets.

@rutger1140
rutger1140 / csshelpers.js
Created February 15, 2012 08:03
Add CSS helper classes in jQuery
/**
* CSS Helpers
* @description: Used for decorating input types, first and last childs
*/
$('input[type=checkbox]').addClass('checkbox');
$('input[type=radio]').addClass('radio');
$('input[type=file]').addClass('file');
$('[disabled=disabled]').addClass('disabled');
$('table').find('tr:even').addClass('even');
$('table').find('tr:first-child').addClass('first');
@rutger1140
rutger1140 / cleandsstores.sh
Created March 14, 2012 11:03
Clean up DS store files on OSX
#!/bin/sh
# bash script to clean (delete) Finder .DS_Store, .Trashes and ._resources
# Use cleandsstores.sh
# juanfc 2010-03-06
if [ $# != 1 ]
then
echo "ERROR: use\n\t`basename $0` dirtoclean"
exit 1
fi
@rutger1140
rutger1140 / viewportwidth.js
Created April 12, 2012 10:03
Display viewport width with jQuery
/**
* Display your window width - useful for responsive web design
* @author: Rutger Laurman
*/
// Ready?
$(function(){
// Create debug element
$("body").append("<div style='position:fixed;top:0;left:0;border:1px solid #999;background:#eee;' id='viewportwidth'></div>");
@rutger1140
rutger1140 / gist:2508600
Created April 27, 2012 11:46
Micro clearfix in LESS
/* Micro clearfix - lrdk.nl/ck */
.cf {
zoom: 1;
&:before,
&:after {
content: "";
display: table;
}
&:after {
clear: both;
@rutger1140
rutger1140 / searchtwitter.js
Created June 14, 2012 13:16
Simple Twitter search with jQuery
/* Simple Twitter search */
var hashtag = "#ek2012";
var urlhash = encodeURIComponent(hashtag);
var numPosts = 1;
var target = $("#tweetwrap");
var ajaxurl = "http://search.twitter.com/search.json?callback=?&q="+urlhash+ "&rpp="+numPosts;
$.getJSON(
ajaxurl,
function (data){
@rutger1140
rutger1140 / gist:2978810
Created June 23, 2012 16:03
Social sharing links
@rutger1140
rutger1140 / gist:3041437
Created July 3, 2012 18:05
Preferences.sublime-settings
{
"auto_indent": true,
"color_scheme": "Packages/Color Scheme - Default/Railscasts.tmTheme",
"default_line_ending": "unix",
"detect_indentation": false,
"draw_minimap_border": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"font_face": "BitstreamVeraSansMono-Roman",
@rutger1140
rutger1140 / gist:3046805
Created July 4, 2012 11:12
Prevent console.log errors in IE
// Prevent console.log errors
if (typeof console=="undefined") {
console={log:function(A){return;}}
}
@rutger1140
rutger1140 / viewport-bookmarklet.html
Created July 6, 2012 14:19
Viewport bookmarklet
<html>
<body>
<h1>Viewport bookmarklet</h1>
<p>
Show tiny counter in top left corner of viewport, with current window size.<br>
<em>Uses jQuery</em>
</p>
<h2>Usage</h2>
<ol>
<li>Drag to bookmark bar</li>
@rutger1140
rutger1140 / twitterexport.php
Created August 9, 2012 14:03
Export all your tweets
<?php
/**
* This script will allow the export of complete user time-lines from the twitter
* service. It joins together all pages of status updates into one large XML block
* that can then be reformatted/processed with other tools.
*
* @since 10/13/08
*
* @copyright Copyright © 2008, Adam Franco
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)