This file contains 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
license: gpl-3.0 | |
title: uStates |
This file contains 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
<?php | |
function formatPhone($num) { | |
$num = preg_replace('/[^\dx]/i', '', $num); | |
preg_match('/(x)\.?:?\s*?(\d+)/i', $num, $ext); | |
if (!empty($ext)) { | |
$ext = ' ext ' . preg_replace('/\D/', '', $ext[0]); | |
$num = preg_replace('/(x)\.?:?\s*?(\d+)/i', '', $num); | |
} | |
This file contains 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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow |
This file contains 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
<?php | |
# execution time (at script start) | |
$beginTime = microtime(true); | |
# execution time (upon script end) | |
$output["time"] = number_format(microtime(true) - $beginTime, 2) . " seconds"; | |
?> |
This file contains 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
// IE7 fix for .forEach function | |
if (!Array.prototype.forEach) { | |
Array.prototype.forEach = function(fn, scope) { | |
for(var i = 0, len = this.length; i < len; ++i) { | |
fn.call(scope, this[i], i, this); | |
} | |
} | |
} | |
// IE7 & IE8 fix for .indexOf function |
This file contains 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
Date.prototype.extractTime = function() { | |
var h = this.getHours(), | |
m = this.getMinutes(), | |
s = this.getSeconds(); | |
return h + ":" + m + ":" + s; | |
} | |
var d = new Date(); | |
console.log(d.extractTime()); |
This file contains 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
$(document).keydown(function(e) { | |
if (e.keyCode === 8) { | |
var element = e.target.nodeName.toLowerCase(); | |
if ((element != 'input' && element != 'textarea') || $(e.target).attr("readonly")) { | |
return false; | |
} | |
} | |
}); |
This file contains 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 request = {}; | |
request['action'] = 'submit'; | |
request['data'] = $(this).val() || $(this).closest('form').serialize(); | |
$.ajax({ | |
url: "<?= $URL; ?>", || url: 'someFile.php', | |
data: request, || JSON.stringify(request), || | |
type: 'POST', | |
cache: false, | |
dataType: 'json' |
This file contains 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
Number.prototype.formatMoney = function(c, d, t) { | |
var n = this, | |
c = isNaN(c = Math.abs(c)) ? 2 : c, | |
d = d == undefined ? "." : d, | |
t = t == undefined ? "," : t, | |
s = n < 0 ? "-" : "", | |
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", | |
j = (j = i.length) > 3 ? j % 3 : 0; | |
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); |
This file contains 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
[ | |
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} }, | |
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} }, | |
{ "keys": ["alt+shift+o"], "command": "run_macro_file", "args": {"file": "Packages/User/output.sublime-macro"} }, | |
{ "keys": ["alt+shift+c"], "command": "run_macro_file", "args": {"file": "Packages/User/console.sublime-macro"} }, | |
{ "keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index": 0 } } | |
] |