Skip to content

Instantly share code, notes, and snippets.

View imehr's full-sized avatar

Mehran Mozaffari imehr

View GitHub Profile
@imehr
imehr / gist:5227092
Created March 23, 2013 09:11
#css - Image replacement
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@imehr
imehr / gist:5229995
Created March 24, 2013 01:10
javascript: #table, #fix-header #scroll
$(document).ready(function() {
TABLE.fixHeader('table')
});
var TABLE = {};
TABLE.fixHeader = function(table) {
$(table).each(function() {
var $table = $(this);
var $thead = $table.find('thead');
@imehr
imehr / gist:5230000
Created March 24, 2013 01:12
javasctipt: #table, #clone-header
$(document).ready(function() {
TABLE.repeatHeader('#celebs', 10)
});
var TABLE = {};
TABLE.repeatHeader = function(table, every){
$(table).each(function() {
var $this = $(this);
var rowsLen = $this.find('tr:not(:first)').length;
@imehr
imehr / gist:5231238
Created March 24, 2013 09:47
javascript: jquery: #not() #delegate #multiple selector
$("#test_form").delegate("input:not([id*='_submit']), select", "blur", function(e) {
// Does something
});
@imehr
imehr / gist:5267592
Created March 28, 2013 23:14
javascript #module pattern
// http://stackoverflow.com/questions/12042260/how-to-use-the-javascript-module-pattern-in-a-real-example
var myApp = (function() {
var someElement = $("#foo"); //some element I know I'll use lots
var addMessage = function(message) {
$.ajax({
url: '/test',
type: 'POST',
{
"glossary": {
"title": "example glossary ABC",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",