Skip to content

Instantly share code, notes, and snippets.

View singhmohancs's full-sized avatar
👨‍💻
Building with JavaScript, React, Angular, NodeJs, MongoDb and AWS Serverless

Mohan Singh singhmohancs

👨‍💻
Building with JavaScript, React, Angular, NodeJs, MongoDb and AWS Serverless
View GitHub Profile
@singhmohancs
singhmohancs / git-reset-remote.sh
Last active August 7, 2023 08:03 — forked from CaroManel/git-reset-remote.sh
delete all commits, empty repository
rm -r .git
git init
(create files)
git add -A
git commit -m 'Initial commit'
git remote add origin <url>
git push --force --set-upstream origin master
@singhmohancs
singhmohancs / README.md
Created April 13, 2020 04:30 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@singhmohancs
singhmohancs / javascript-object-to-querystring.js
Created June 16, 2019 04:32 — forked from tjmehta/javascript-object-to-querystring.js
Object to Querystring - JavaScript, JS, JSON
function objectToQuerystring (obj) {
return Object.keys.reduce(function (str, key, i) {
var delimiter, val;
delimiter = (i === 0) ? '?' : '&';
key = encodeURIComponent(key);
val = encodeURIComponent(obj[key]);
return [str, delimiter, key, '=', val].join('');
}, '');
}

##Change default Mac OS X PHP to XAMPP's PHP Installation and Install Composer

Find out what version of PHP is running

which php

This will output the path to the default PHP install which comes preinstalled by Mac OS X, by default

@singhmohancs
singhmohancs / country-list.json
Created December 9, 2018 06:55
country list with dial code and iso2
[{
"name": "Afghanistan (‫افغانستان‬‎)",
"iso2": "af",
"dialCode": "93"
}, {
"name": "Albania (Shqipëri)",
"iso2": "al",
"dialCode": "355"
}, {
"name": "Algeria (‫الجزائر‬‎)",
@singhmohancs
singhmohancs / form-Auto-fill-Fix.directive.js
Created January 19, 2018 08:24
Fix autocomplete (autofill) form in Angular
angular.module('A').directive('formAutofillFix', function ($timeout) {
return function (scope, element, attrs) {
element.prop('method', 'post');
if (attrs.ngSubmit) {
$timeout(function () {
element
.unbind('submit')
.bind('submit', function (event) {
event.preventDefault();
element
@singhmohancs
singhmohancs / matchers.js
Created December 20, 2017 13:04 — forked from tomyam1/matchers.js
Custom matchers for Protractor and Jasmine 2
"use strict";
var _ = require('lodash');
/**
* Custom matchers for protractor and jasmine 2
*
* expect(el).toBePresent();
* expect(el).toBeDisplayed();
* expect(el).toContainText('text to contain');
@singhmohancs
singhmohancs / gist:e430068ac9642156fe962ad7bd888b5e
Created August 31, 2017 12:44 — forked from josephdburdick/gist:49a4bb299a614d8f3f77
Gulpfile - precompress and sprite generation
'use strict';
// generated on 2014-06-24 using generator-gulp-webapp 0.1.0
var src_dir = 'app',
dest_dir = 'dist';
var gulp = require('gulp');
// load plugins
@singhmohancs
singhmohancs / Setting up subdomain with Drupal installation on Linode
Created August 27, 2017 22:30 — forked from klan/Setting up subdomain with Drupal installation on Linode
How to set up a subdomain on a Linode server with a Drupal installation and a repository
• SSH to your server to start creating a subdomain (https://library.linode.com/hosting-website#sph_configuring-name-based-virtual-hosts)
• Go to ~/public/
› mkdir -p sub.example.com/{public,log,backup}
› cd sub.example.com/public/
› nano index.html | nano index.php
• Write 'Hello world' or whatever, we just need a html|php file to test with
@singhmohancs
singhmohancs / _baseline.scss
Created August 10, 2017 18:57 — forked from razwan/_baseline.scss
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {