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 / 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) {
/**
* Calculates numbers to the mathmatical power (exponent)
*
* @since 1.0.0
*
* @param int $number The number to increase
* @param int $exponent The power to increase the number by
*
* @return int The new number
*/
@singhmohancs
singhmohancs / viewport-units-ios.scss
Created August 10, 2017 16:22 — forked from BenMorel/viewport-units-ios.scss
SCSS mixin to support vh and vw units on all iOS Safari versions. Based on an idea by Patrick Burtchaell's: https://gist.github.com/pburtchaell/e702f441ba9b3f76f587
/**
* Fix for vw, vh, vmin, vmax on iOS 7.
* http://caniuse.com/#feat=viewport-units
*
* This fix works by replacing viewport units with px values on known screen sizes.
*
* iPhone 6 and 6 Plus cannot run iOS 7, so are not targeted by this fix.
* Target devices running iOS 8+ will incidentally execute the media query,
* but this will still produce the expected result; so this is not a problem.