This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.toggleText = function(b) { | |
return this.each(function() { | |
var $this = $(this); | |
if ( !$this.data('text') ) { | |
$this.data( 'text', $this.text() ); | |
} | |
$this.text( $this.text() !== b ? b : $this.data('text') ); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.hoverClassLive = function(str) { | |
var klass = str || 'hover'; | |
return this.live('hover', function() { | |
$(this).toggleClass(klass); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.random = function() { | |
var rand = Math.floor( Math.random() * this.length + 1 ); | |
return this[rand]; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set dbUser=root | |
set dbPassword=password | |
set backupDir="C:\Documents and Settings\user\Desktop\backup\mysql" | |
set mysqldump="C:\Program Files\MySQL\MySQL Workbench 5.2 CE\mysqldump.exe" | |
set mysqlDataDir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data" | |
set zip="C:\Program Files\7-Zip\7z.exe" | |
:: get date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.sameSize = function( width, max ) { | |
var prop = width ? 'width' : 'height', | |
size = Math.max.apply( null, $.map( this, function( elem ) { | |
return $( elem )[ prop ](); | |
})), | |
max = size < max ? size : max; | |
return this[ prop ]( max || size ); | |
}; | |
// same height |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mc | |
mc.ActivateWindow(14000) | |
item_list = mc.ListItems() | |
item = mc.ListItem(mc.ListItem.MEDIA_PICTURE) | |
item.SetPath('http://sindresorhus.com/slider-img/1.jpg') | |
item.SetImage(0, 'http://sindresorhus.com/slider-img/1.jpg') | |
item.SetContentType('image/jpeg') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.touchHover = function() { | |
return 'ontouchstart' in document.documentElement ? this.click(function() { | |
$(this).toggleClass('hover'); | |
}) : this; | |
}; | |
/* | |
Example: $('.button').touchHover(); | |
You also need to add .hover to your :hover CSS rules: | |
.button:hover -> .button:hover, .button.hover | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "admin/change_form.html" %} | |
{% block extrahead %} | |
{{ block.super }} | |
<script > | |
// override openCalendar to set the date of calendar A to calendar B | |
var _openCalendar = DateTimeShortcuts.openCalendar; | |
DateTimeShortcuts.openCalendar = function(num) { | |
_openCalendar.call( this, num ); | |
var cals = DateTimeShortcuts.calendars; | |
cals[1].drawDate( cals[0].currentMonth, cals[0].currentYear ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ad": [ | |
"42.5000", | |
"1.5000" | |
], | |
"ae": [ | |
"24.0000", | |
"54.0000" | |
], | |
"af": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = function() { | |
var xhr = new XMLHttpRequest(); | |
return function( method, url, callback ) { | |
xhr.onreadystatechange = function() { | |
if ( xhr.readyState === 4 ) { | |
callback( xhr.responseText ); | |
} | |
}; | |
xhr.open( method, url ); | |
xhr.send(); |
OlderNewer