Skip to content

Instantly share code, notes, and snippets.

Fazlur Rahman fazlurr

View GitHub Profile

Font Face

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


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

@include font-face(Samplino, fonts/Samplino);
fazlurr /
Created Apr 10, 2019 — forked from bentinata/
  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
$project: {
hour: {
$hour: "$processing_at"
}, {
$match: {
hour: {
"$in": [18]
View gist:61857a1db455665e237dadfa6c5a9f03
check process redis-server
with pidfile "/var/run/"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host port 6379 then restart
if 5 restarts within 5 cycles then timeout
View fakeLocalStorage.js
// Fake localStorage implementation.
// Mimics localStorage, including events.
// It will work just like localStorage, except for the persistant storage part.
var fakeLocalStorage = function() {
var fakeLocalStorage = {};
var storage;
// If Storage exists we modify it to write to our fakeLocalStorage object instead.
// If Storage does not exist we create an empty object.
View retry.js
url : 'someurl',
type : 'POST',
data : ....,
tryCount : 0,
retryLimit : 3,
success : function(json) {
//do something
View progress.js
let config = {
onUploadProgress: progressEvent => {
let percentCompleted = Math.floor((progressEvent.loaded * 100) /;
// do whatever you like with the percentage complete
// maybe dispatch an action that will update a progress bar or something
}'/path/to/post/', data, config)
.then(response => console.log(response));
View copy.js
const copyToClipboard = str => {
const el = document.createElement('textarea'); // Create a <textarea> element
el.value = str; // Set its value to the string that you want copied
el.setAttribute('readonly', ''); // Make it readonly to be tamper-proof = 'absolute'; = '-9999px'; // Move outside the screen to make it invisible
document.body.appendChild(el); // Append the <textarea> element to the HTML document
const selected =
document.getSelection().rangeCount > 0 // Check if there is any content selected previously
? document.getSelection().getRangeAt(0) // Store selection if found
View validUrl.js
function isValidURL(str) {
var pattern = new RegExp('^((https?:)?\\/\\/)?'+ // protocol
'(?:\\S+(?::\\S*)?@)?' + // authentication
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locater
if (!pattern.test(str)) {
return false;
fazlurr / validation.js
Created Sep 21, 2018
Custom Error Messages for jQuery Validation -
View validation.js
jQuery.extend(jQuery.validator.messages, {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL.",
date: "Please enter a valid date.",
dateISO: "Please enter a valid date (ISO).",
number: "Please enter a valid number.",
digits: "Please enter only digits.",
creditcard: "Please enter a valid credit card number.",
You can’t perform that action at this time.