# ~/.ssh/config
Host {work}.bitbucket.com
HostName {work}.bitbucket.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/{work}
Host bitbucket.org
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
/** | |
* Originally wrote this snippet for Suffragette/Pathé campaign (https://apps.facebook.com/inspiring-women) | |
* | |
* The campaign app forms a grid of square images pulled from social APIs based on | |
* particular hashtags. This snippet sets the new width and | |
* height based on their natural width and height to maintain the aspect ratio. | |
* Works best for 1:1 aspect ratio but can be modified to accommodate other ratio. | |
* | |
* @param Element|Resource img - An image element/resource from DOM | |
* @param int expected - Expected width or height |
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
const redactedEmail = email.replace(/(.{2})(.*)(@.*)/, '$1...$3'); |
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
npx -p typescript tsc {file_name.js} --declaration --allowJs --emitDeclarationOnly --outDir {output_dir_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
/** | |
* Use this bookmarklet to start WhatsApp chat without saving a contact first | |
*/ | |
(function(){ | |
let phone = window.prompt('Enter phone with country code'); | |
if (Boolean(phone)) { | |
phone = phone.startsWith('+') ? phone : phone.startsWith('0') ? phone.replace(/^0+/, '+') : phone.padStart(phone.length+1, '+'); | |
window.open(`https://wa.me/${phone}`); | |
} | |
}()); |
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
/** | |
* 1. Save the following JavaScript snippet as browser bookmark | |
* 2. Visit a webpage and click on saved bookmark | |
* 3. Watch the webpage elements dance | |
* Original story by Mozilla - https://hacks.mozilla.org/2014/02/html5-css3-and-the-bookmarklet-that-shook-the-web/ | |
*/ | |
javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=docume |
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
// Enable IE8 support for indexOf | |
if ( typeof Array.prototype.indexOf === 'undefined' ) { | |
Array.prototype.indexOf = function(item) { | |
for (var i = 0; i < this.length; i++) { | |
if (this[i] === item) { | |
return i; | |
} | |
return -1; | |
} | |
} |
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
#!/bin/sh | |
# | |
# @author: Jabran Rafique <hello@jabran.me> | |
# @link: http://jabran.me/articles/automatic-database-backup-using-git-hosting/ | |
# Set variables | |
FULLDATE = $(date +"%Y-%d-%m %H:%M") | |
NOW = $(date +"%Y-%m-%d-%H-%M") | |
MYSQL_DUMP = `which mysqldump` | |
GIT = `which git` |
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
{ | |
"Use Non-ASCII Font" : false, | |
"Tags" : [ | |
], | |
"Ansi 12 Color" : { | |
"Green Component" : 0.3333333432674408, | |
"Blue Component" : 1, | |
"Red Component" : 0.3333333432674408 | |
}, |
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
.rsync_cache | |
.vagrant | |
*~ | |
Guardfile | |
*.swp | |
.idea | |
.DS_Store? | |
.DS_Store | |
ehthumbs.db | |
Icon? |
NewerOlder