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
// convert string to proper case | |
String.prototype.toProperCase = function () { | |
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
}; | |
// convert string to snake case | |
String.prototype.toSnakeCase = function () { | |
return this.replace(/(.)([A-Z])/g, "$1_$2").toLowerCase(); | |
}; |
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 last_position = {}; | |
document.onmousemove = function(e) { | |
//check to make sure there is data to compare against | |
if (typeof(last_position.x) != 'undefined') { | |
//get the change from last position to this position | |
var deltaX = last_position.x - event.clientX, | |
deltaY = last_position.y - event.clientY; |
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.onkeydown = function(e) { | |
switch(e.which) { | |
case 37: | |
// left direction | |
break; | |
case 38: | |
// up direction | |
break; |
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 xDown = null; | |
var yDown = null; | |
document.addEventListener('touchstart', handleTouchStart, false); | |
document.addEventListener('touchmove', handleTouchMove, false); | |
function handleTouchStart(evt) { | |
xDown = evt.touches[0].clientX; | |
yDown = evt.touches[0].clientY; | |
}; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<body> | |
<form name="user-form" id="user-form" enctype="multipart/form-data"> | |
<input type="file" name="image_file"> | |
<input type="text" name="name"> | |
<img src="" id="image_file"> | |
<button type="button" title="Save" id="save-user">Save</button> | |
</form> | |
<script type="text/javascript"> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Fancybox</title> | |
<style type="text/css"> | |
/* Fancybox */ | |
.fancyimg { | |
border-radius: 5px; | |
cursor: pointer; | |
transition: 0.3s; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>User Form</title> | |
</head> | |
<body> | |
<input type="hidden" name="user_id" value="1"> | |
<form name="user-form" id="user-form" enctype="multipart/form-data"> | |
<input type="file" name="image_file"> | |
<input type="text" name="name"> |
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
#Open ~/.bashrc file and past the following code at the end | |
alias gs='git status' | |
alias ga='git add -A' | |
alias gc='git commit -a -m $1' | |
alias gp='git push origin master' | |
alias gpl='git pull origin master' |
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
<IfModule mod_rewrite.c> | |
<IfModule mod_negotiation.c> | |
Options -MultiViews | |
</IfModule> | |
# Enable Compression | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject |