Skip to content

Instantly share code, notes, and snippets.

View tje3d's full-sized avatar
🏠
Working from home

Moein Porkamel tje3d

🏠
Working from home
View GitHub Profile
var exec = require('child_process').exec;
var targetBranch = process.argv[2] || "develop"
var title = process.argv[3] || "initial task"
var description = process.argv[4] || "initial task"
exec("git push origin HEAD \
-o merge_request.create \
-o merge_request.remove_source_branch \
-o merge_request.title=" + title + " \
@sagar-gavhane
sagar-gavhane / multipleOfHundred.js
Created January 12, 2019 12:26
Yupjs multipleOfHundred custom validation
import * as Yup from "yup";
const values = 0;
const msg = "value should be multiple of hundred";
Yup.addMethod(Yup.number, "multipleOfHundred", function(msg) {
return this.test("test-name", msg, function(value) {
const { path, createError } = this;
return value % 100 === 0 && value !== 0;
@loicginoux
loicginoux / firebase-messaging-sw.js
Last active June 11, 2024 02:39
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
@odan
odan / xmapp-replacing-mariadb-with-mysql.md
Last active June 4, 2023 19:44
XAMPP - Replacing MariaDB with MySQL

XAMPP - Replacing MariaDB with MySQL

This post has been deleted.

@paulirish
paulirish / what-forces-layout.md
Last active June 22, 2024 12:14
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 25, 2024 16:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@anik
anik / Visual Composer Shortcode
Last active August 2, 2016 11:20
Visual Composer Shortcode
*********************************************************************************
*********************************************************************************
// Checkbox
// Color Picker
// Number
// Dropdown
// Textfield
// Attach Image
// Textarea HTML
// Add Link
@umidjons
umidjons / remove-all-dots-except-last.md
Created January 7, 2015 10:02
Remove all dots except one in JavaScript with RegEx

Remove all dots except one in JavaScript with RegEx

'123.345..456456.00'.replace(/,/g,'.').replace(/[.](?!\d*$)/g,''); // 123345456456.00
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*