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
.header-main { | |
border-bottom: 1px solid #ebebeb; | |
} | |
.header-main.sticky-header { | |
border-bottom-color: transparent; | |
} | |
.header-v2 .navbar-nav > li > a:before { | |
bottom: -1px; |
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 | |
/** | |
* @param string $url | |
* @see https://stackoverflow.com/a/51246730/5627904 | |
*/ | |
function get_youtube_id($url) { | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ |
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
workbox.routing.registerNavigationRoute('/index.html') | |
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
function hexToRgb(hex) { | |
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") | |
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; | |
hex = hex.replace(shorthandRegex, function(m, r, g, b) { | |
return r + r + g + g + b + b; | |
}); | |
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
return result ? { | |
r: parseInt(result[1], 16), |
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
/** | |
* Decode URI Component safe to use with single % | |
* | |
* @param {string} s String to Decode | |
* @return {string} Decoded Result | |
* | |
* @see https://stackoverflow.com/a/54310080/5627904 | |
*/ | |
export const decodeURIComponentSafe = (s) => { | |
if (!s) return s; |
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
function printcontent() { | |
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; | |
disp_setting+="scrollbars=yes,width=300, height=350, left=50, top=25"; | |
var content_vlue = document.getElementById("content").innerHTML; | |
var w = window.open("","", disp_setting); | |
w.document.write(content_vlue); //only part of the page to print, using jquery | |
w.document.close(); //this seems to be the thing doing the trick | |
w.focus(); | |
w.print(); | |
w.close(); |
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
function gen(N) { | |
return ~~(Math.random() * N) + 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 | |
# Make sure to: | |
# 1) Name this file `backup.sh` and place it in /home/ubuntu | |
# 2) Run sudo apt-get install awscli to install the AWSCLI | |
# 3) Run aws configure (enter s3-authorized IAM user and specify region) | |
# 4) Fill in DB host + name | |
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket) | |
# 6) Run chmod +x backup.sh | |
# 7) Test it out via ./backup.sh |
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 | |
set -e | |
HOST=localhost | |
DB=test-entd-products | |
COL=asimproducts | |
S3PATH="s3://mongodb-backups-test1-entd/$DB/$COL/" | |
S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz | |
S3LATEST=$S3PATH"latest".dump.gz | |
/usr/bin/aws s3 mb $S3PATH |
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 checkHTML = function(html) { | |
var doc = document.createElement('div'); | |
doc.innerHTML = html; | |
return ( doc.innerHTML === html ); | |
} |