$ git commit -m "Something terribly misguided" # (1)
$ git reset HEAD~ # (2)
<< edit files as necessary >> # (3)
$ git add ... # (4)
$ git commit -c ORIG_HEAD # (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
| RewriteEngine On | |
| RewriteCond %{SERVER_PORT} 80 | |
| RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
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
| RewriteEngine On | |
| RewriteCond %{HTTP_HOST} !="" | |
| RewriteCond %{HTTP_HOST} !^www\. [NC] | |
| RewriteCond %{HTTPS}s ^on(s)| | |
| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
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
| function getUnixTimeFromDate (date) { | |
| if ( typeof(date) === 'undefined' ) { | |
| throw 'Date is required'; | |
| } | |
| // using lodash _.isEmpty if available | |
| if ( typeof window._.isEmpty === 'function' && _.isEmpty(date) ) { | |
| throw 'Date cannot be empty.'; | |
| } else if( date === '' || date == '' ) { | |
| throw 'Date cannot be empty.'; |
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
| function number_format (number, decimals, dec_point, thousands_sep) { | |
| // Strip all characters but numerical ones. | |
| number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); | |
| var n = !isFinite(+number) ? 0 : +number, | |
| prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), | |
| sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, | |
| dec = (typeof dec_point === 'undefined') ? '.' : dec_point, | |
| s = '', | |
| toFixedFix = function (n, prec) { | |
| var k = Math.pow(10, prec); |
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
| (function(){ | |
| // Allow only alphabets & _ - whitespaces, strip out all others. | |
| function clean(str) { | |
| return str.replace(/[^a-z-A-Z\&\_\- ]/g, "").replace(/ +/, " ") | |
| } | |
| $('body').on('keyup', '#ask_message_textarea, #ask_message_title', function(event) { | |
| this.value = clean(this.value); |
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 fromTitle = 'Paris'; | |
| var toTitle = 'paris_fr'; | |
| // Note: if id is same and title is updated then it won't change, so set a new id if you are updating a label and then set it back | |
| var fromId = 'New York'; | |
| var toId = 'new-york-city_ny_us'; | |
| var newFromOption = new Option(fromTitle, fromId, false, false); | |
| $('.fromLocation').eq(0).append(newFromOption); // add the option because of AJAX it would not exist | |
| $('.fromLocation').eq(0).val(fromId); // Select the option with the value |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
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 tooltip, // global variables oh my! Refactor when deploying! | |
| hidetooltiptimer | |
| function createtooltip(){ // call this function ONCE at the end of page to create tool tip object | |
| tooltip = document.createElement('div') | |
| tooltip.style.cssText = | |
| 'position:absolute; background:black; color:white; padding:4px;z-index:10000;' | |
| + 'border-radius:2px; font-size:12px;box-shadow:3px 3px 3px rgba(0,0,0,.4);' | |
| + 'opacity:0;transition:opacity 0.3s' | |
| tooltip.innerHTML = 'Copied!' |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css"> | |
| <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.0/css/font-awesome.css"> | |
| <script src="http://code.jquery.com/jquery-1.8.2.js"></script> | |
| <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> | |
| <style> |