Skip to content

Instantly share code, notes, and snippets.

Fazlur Rahman fazlurr

Block or report user

Report or block fazlurr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View hexToRgb.js
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),
View decode.js
/**
* 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;
View print.js
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();
@fazlurr
fazlurr / mongodb-s3-backup.sh
Created May 22, 2019 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
View mongodb-s3-backup.sh
#!/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
@fazlurr
fazlurr / backup-mongodb-to-s3.sh
Created May 22, 2019 — forked from caraboides/backup-mongodb-to-s3.sh
Simple script to backup MongoDB to S3, without waste diskspace for temp files. And a way to restore from the latest snapshot.
View backup-mongodb-to-s3.sh
#!/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
View htmlValidator.js
var checkHTML = function(html) {
var doc = document.createElement('div');
doc.innerHTML = html;
return ( doc.innerHTML === html );
}
View README.md

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@fazlurr
fazlurr / ID.md
Created Apr 10, 2019 — forked from bentinata/ID.md
Slaquette
View ID.md
  1. Jadilah pengguna yang berguna.

  2. Gunakan channel yang patut.
    #general untuk kepentingan umum
    #random jika ingin bercanda
    #rpl atau #mppl untuk diskusi mata kuliah dan tugas terkait
    #channel_kelompok untuk diskusi masing-masing kelompok.

  3. Kaji ulang setiap pesan yang akan dibuat.
    Pesan singkat dan langsung pada intinya.

View query
db.getCollection('submission').aggregate([{
$project: {
hour: {
$hour: "$processing_at"
}
}
}, {
$match: {
hour: {
"$in": [18]
You can’t perform that action at this time.