Skip to content

Instantly share code, notes, and snippets.

View vishaltelangre's full-sized avatar

Vishal Telangre vishaltelangre

View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE:
// Uses a combination of object detection and user-agent
// sniffing.
// ----------------------------------------------------------
// If you're not in IE then:
// ie === NaN // falsy
// If you're in IE then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
@Kambfhase
Kambfhase / LICENSE.txt
Last active September 25, 2015 22:28 — forked from 140bytes/LICENSE.txt
Brainfuck139
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Kambfhase
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
@a-chernykh
a-chernykh / application_controller.rb
Created June 22, 2011 19:43
devise force https for sign in and sign up routes
class ApplicationController < ActionController::Base
before_filter :ensure_proper_protocol
protected
def ssl_allowed_action?
(params[:controller] == 'users/sessions' && ['new', 'create'].include?(params[:action])) ||
(params[:controller] == 'users/registrations' && ['new', 'create', 'edit', 'update'].include?(params[:action])) ||
(params[:controller] == 'users/omniauth_callbacks')
end
@mixin active($selector) {
#{$selector} {
color:black;
}
}
#my-id {
@include active($selector: ".my-class")
}
@padolsey
padolsey / cat.js
Created December 4, 2011 19:00
Improving Jeremy Keith's CAT news example from http://24ways.org/2011/conditional-loading-for-responsive-designs
var cat = {};
/**
* cat.NewsBox
* Retrieves news from Google
*/
cat.NewsBox = (function(){
function NewsBox(searchTerm, injectFn) {
this.searchTerm = searchTerm;
@apneadiving
apneadiving / users_controller.rb
Created January 20, 2012 00:25
gmaps4rails: Don't show map by default and load markers with ajax
class UsersController < ApplicationController
respond_to :html, :json
def index
@json = User.all.to_gmaps4rails
respond_with @json
end
end
var ALPHA = 'abcdefghijklmnopqrstuvwxyz',
ALPHA_UPPER = ALPHA.toUpperCase(),
NUMERIC = '0123456789',
PUNCTUATION = '-!@£$%^&*()[]{}\'"/?.>,<;:\\|~`€#',
UNDERSCORE = '_',
WHITESPACE = '\x20\t\n\r\f\v\xa0\u2028\u2029\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff'; // thanks Mathias!
var SHORTHAND_CC = {
'\\S': ALPHA + ALPHA_UPPER + NUMERIC + PUNCTUATION + UNDERSCORE,
'\\s': WHITESPACE,
@iHiD
iHiD / post-commit
Created September 21, 2012 13:47 — forked from consti/post-commit
Take a photo of you, whenever you make a commit
#!/bin/sh
#
# Take a photo of you, whenever you make a commit
#
# This is an improved version of Víctor Martínez original post:
# http://coderwall.com/p/xlatfq
#
# Improvements:
// From the 140bytes wishlist here: https://github.com/jed/140bytes/wiki/Wishlist
// TASK:
// Create a function which can create a DOM structure from this:
//
domBuilder(
[/HTML/],
[/HEAD/],
[/TITLE/],
"Wouldn't this be cool?",
[],
@tcr
tcr / summary.md
Created October 25, 2012 15:56
How do you use a different DNS entry per domain name in OS X?

Use /etc/resolver. For instance, to change the DNS servers for irc.freenode.net, create the file

/etc/resolver/irc.freenode.net

And set its contents to

nameserver 8.8.8.8

nameserver 8.8.4.4