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
# tar directory | |
tar -czvf Output_File_Name.tar.gz Directory_Name | |
tar -zcvf demo.tar.gz demo | |
# which will create a tar file named "demo.tar.gz" | |
# to untar directory | |
tar -xzvf Input_File_Name.tar.gz |
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
// Numeric only control handler | |
jQuery.fn.ForceNumericOnly = | |
function() | |
{ | |
return this.each(function() | |
{ | |
$(this).keydown(function(e) | |
{ | |
var key = e.charCode || e.keyCode || 0; | |
// allow backspace, tab, delete, enter, arrows, numbers and keypad numbers ONLY |
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
/** | |
* @param $prefix | |
* @param $suffix | |
* @param $size | |
* | |
* @return string | |
*/ | |
private function randomKey($prefix, $suffix, $size) | |
{ | |
$key = ""; |
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
// SOURCE: http://blog.tompawlak.org/number-currency-formatting-javascript | |
function formatNumber (num) { | |
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); | |
} | |
console.info(formatNumber(2665)); // 2,665 | |
console.info(formatNumber(102665)); // 102,665 | |
console.info(formatNumber(111102665)); // 111,102,665 | |
console.info(formatNumber(1240.5)); // 1,240.5 |
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
/* euclidean GCD (feel free to use any other) */ | |
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;} | |
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */ | |
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)} | |
/* eg: | |
> ratio(320,240) | |
"4:3" | |
> ratio(360,240) |
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
# enable site | |
sudo a2ensite | |
# disable site | |
sudo a2dissite | |
# enable an apache2 module | |
sudo a2enmod | |
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user |
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
/* | |
* Replace all SVG images with inline SVG | |
*/ | |
jQuery('img.svg').each(function(){ | |
var $img = jQuery(this); | |
var imgID = $img.attr('id'); | |
var imgClass = $img.attr('class'); | |
var imgURL = $img.attr('src'); | |
jQuery.get(imgURL, function(data) { |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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
<div class="videoWrapper"> | |
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe> | |
</div> | |
<style> | |
.videoWrapper { | |
position: relative; | |
padding-bottom: 56.25%; /* 16:9 */ | |
padding-top: 25px; | |
height: 0; |
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
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
// ************************************************** | |
// USING: | |
// npm install node-sass -g | |
// npm install uglify-js -g | |
// npm install html-minifier -g | |
// ************************************************** | |
{ | |
"version": "2.0.0", |