Skip to content

Instantly share code, notes, and snippets.

Avatar

Ram Ratan Maurya mauryaratan

View GitHub Profile
@gmazzap
gmazzap / VersionNumber.php
Created Mar 24, 2019
Version number parser and comparator compatible with both Semver and WordPress version numbers.
View VersionNumber.php
<?php
/**
* Copyright 2019 Inpsyde GmbH
*
* @license MIT https://opensource.org/licenses/MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@edenthecat
edenthecat / holler.md
Last active Feb 9, 2018
Alert me when a process is complete
View holler.md

Install terminal-notifier via homebrew: https://github.com/julienXX/terminal-notifier

If using zsh, create an alias: alias -g holler="echo 'holler' | terminal-notifier -sound default"

Store it in ./zshrc if you're happy with it!

Now you can run bundle exec rspec ; holler and it will make a notification that says "holler" when your tests are done.

@polevaultweb
polevaultweb / ssl.sh
Created Jan 31, 2018
Easily create local SSL certificates for development sites that work with you own Certificate Authority https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
View ssl.sh
#!/bin/sh
if [ "$#" -ne 1 ]
then
echo "Usage: Must supply a domain"
exit 1
fi
DOMAIN=$1
@malyw
malyw / index.js
Last active Jan 19, 2021
Capture DOM element screenshot using Chrome headless
View index.js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@PaulKinlan
PaulKinlan / waitForElement.js
Last active Jan 18, 2021
waitForElement.js
View waitForElement.js
function waitForElement(selector) {
return new Promise(function(resolve, reject) {
var element = document.querySelector(selector);
if(element) {
resolve(element);
return;
}
var observer = new MutationObserver(function(mutations) {
@msmfsd
msmfsd / es7-async-await.js
Last active Jan 18, 2021
Javascript fetch JSON with ES7 Async Await
View es7-async-await.js
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
View CSS Variables Polyfill.markdown
@brandondurham
brandondurham / styles.less
Last active Aug 1, 2020
Using Operator Mono in Atom
View styles.less
/**
* Using Operator Mono in Atom
*
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
*
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png):
@soundyogi
soundyogi / 2018_chrome_snippet_gui_import_export.js
Last active Nov 3, 2020
A snippet to export and import your chrome snippets
View 2018_chrome_snippet_gui_import_export.js
void function() { "use strict"
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WIP DO NOT USE WIP !!!!!!!!!!!!!!!!!!!!!
DO NOT USE THIS YET.
USE THE 2016 VERSION BELOW PLEASE.
WWWWWWWW WWWWWWWWIIIIIIIIIIPPPPPPPPPPPPPPPPP
W::::::W W::::::WI::::::::IP::::::::::::::::P
W::::::W W::::::WI::::::::IP::::::PPPPPP:::::P