Skip to content

Instantly share code, notes, and snippets.

@oslego
oslego / browserUtil.js
Created Jul 17, 2009
Detect browser CSS capabilities by looking for DOM property references
View browserUtil.js
/**
* @author Razvan Caliman, razvan.caliman@gmail.com
*/
/**
* wrapper for browser sniffing / capabilities check methods
*/
var browser = {};
/**
@oslego
oslego / Simple CSS Liquid Grid
Created Jul 30, 2009
A simple CSS layout grid that suits liquid layouts
View Simple CSS Liquid Grid
.grid_container{
position:relative;
width:100%;
}
.grid_half{
width:50%;
float:left;
}
View N Zakas's JavaScript lazy loader
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
View mysql_database_backup
mysqldump -h localhost -u username -ppassword dbname1 dbname2 --compress --default-character-set=utf8 | gzip -c --best > `date +%Y_%m_%d_dbname.sql.gz`
@oslego
oslego / Apache gzip
Created Nov 19, 2009
Apache gzip filter
View Apache gzip
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/javascript text/javascript text/css application/x-javascript
View Requirements for mechanzie on Unbuntu
apt-get install ruby-dev
gem install hoe
sudo apt-get install libxml2-dev libxslt1-dev
apt-get install libopenssl-ruby
gem install nokogiri
gem install mechanize
@oslego
oslego / jQuery Custom Events Bubble.js
Created Dec 11, 2010
Custom jQuery events triggered on non-DOM elements that bubble (propagate) up to the 'document'
View jQuery Custom Events Bubble.js
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
//non-DOM object events that propagate up to the 'document'
@oslego
oslego / YQL Podcast
Created Dec 14, 2010
Using YQL to get titles and tracks filtered by a search term
View YQL Podcast
select channel.item.enclosure.url, channel.item.title from xml where url='http://www.vibefm.ro/podcast.xml' and channel.item.title like "%Corral%"
@oslego
oslego / SafariKeypressEvents.js
Created Feb 8, 2011
Method for handling keypress events on non-input elements in Safari (and other webkit-based browsers)
View SafariKeypressEvents.js
var div = document.getElementById("demo");
div.setAttribute("tabIndex", 0);
div.focus();
div.addEventListener("keypress", function(e){
console.log(e.keyCode);
})
@oslego
oslego / gist:854869
Created Mar 4, 2011
Bookmarklet Template: Loader
View gist:854869
javascript:(function(){var%20d=document,h=d.getElementsByTagName('head')[0],s=d.createElement('script');s.src='SRC_GOES_HERE';s.type='text/javascript';h.appendChild(s)})()
You can’t perform that action at this time.