Skip to content

Instantly share code, notes, and snippets.

View karbassi's full-sized avatar
🌱

Ali Karbassi karbassi

🌱
View GitHub Profile
#Just pure awesomeness!
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
bind Space:magic-space
# Misc -------------------------------------------------------------
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups:erasedups
# Find process
psf (){ ps auxwww | grep -i \[${1:0:1}\]${1:1}; }
Here's how I edited it.
It should work, but I haven't really ran it through the browser.
Also, if you WANT it to work for IE5, you can include the 'map' function as shown in:
https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/Map#Compatibility
@karbassi
karbassi / gist:247326
Created December 2, 2009 16:25
How to flip number and boolean values from true to false, and vice versa.
// If you want to flip a variable from true to false, you can do the following:
var x = false;
x = !!(~x+2);
// At this point, x is true.
// You can also do this with numbers.
// Let's say you want to flip 0 to 1 or 1 to 0.
// If you want to flip a variable from true to false, you can do the following:
var x = false;
x = !!(x-1);
// At this point, x is true.
// Let's say you want to flip 0 to 1 or 1 to 0:
var y = 1;
This requires CSS2.1 "counter" and ":before". As of now, every browser except IE supports it.
Actually, IE8 supports it, if and only if IE8 is set to render as IE8.
You can check out the compatibility chart PPK made at his site.
http://www.quirksmode.org/css/contents.html
(?xi)
\b
( # Capture 1: entire matched URL
(?:
[a-z][\w-]+: # URL protocol and colon
(?:
/{1,3} # 1-3 slashes
| # or
[a-z0-9%] # Single letter or digit or '%'
# (Trying not to match e.g. "URI::Escape")
// jQuery image magnifier; jdbartlett's rewrite of Chris Iufer's jLoupe
// $('<a href="bigimage.jpg"><img src="smallimg.jpg"></a>').loupe();
// code: http://gist.github.com/252303 - demo: http://jsbin.com/olado3
(function($) {
$.fn.loupe = function(options) {
if (!this.length) return this;
options = $.extend({
loupe: 'loupe',
width: 200,
height: 150
The following Javascript finds the highest z-index in the page and changes the
background color to orange.
What I'm trying to do is find the DOM element with the highest z-index. I have
the following code, but I can't figure out how to do it without having the variable "high".
Can you figure out a better way?
Also, it doesn't seem to work in Safari.
// I was bored.
// Sorry :(
function d(id){ return document.getElementById(id); }
window.onload = function(){
var email_only = d('email_only'),
mail_only = d('mail_only'),
phone_only = d('phone_only');
mail_only.style.display = phone_only.style.display = 'none';
d('contact_us_stype_email').onclick = function () {