Skip to content

Instantly share code, notes, and snippets.

@rufus2021
rufus2021 / metaValueGetter.js
Last active April 19, 2017 22:44
get meta tag and title value from the DOM
const keys = [
'description',
'publishDate',
'keywords',
'author',
'og:site_name',
'og:title',
'og:url',
'og:description',
'og:type',
var operators = ['+', '-', '*', '/'];
var string = '4 2 + 3 5 1 - * +';
var funcs = {
'+': function (a, b) {
return b + a;
},
'-': function (a, b) {
return b - a;
#! /bin/bash
DIR="lib/client/images"
for filename in $DIR/*; do
FILE=${filename##*/};
FOUND=`egrep -lr --include=*.{scss,jsx,js} "($FILE)" ./lib`
if [ "$FOUND" ]
then
var div = document.getElementById('div');
var observer = new MutationObserver(cb);
var config = { attributes: true, attributeOldValue: true, childList: true };
// observe a target
observer.observe(div, config);
// perform some actions on that target which creates a record queue
var child = document.createElement('span');
child.textContent = 'hi there!';
{isFirstItem &&
this.doSomething()
vp.xs && this.doSomethingElse()
}
versus
{isFirstItem && this.doSomething()}
{isFirstItem && vp.xs && this.doSomethingElse()}
// encode a particular part of a url
exports.encodeUrl = function encodeUrl(url, delimiter, keyword) {
var split = url.split(delimiter);
var container = [];
split.map(function (item) {
var replaced = keyword + '=';
if (item.indexOf(keyword) === 0) {
item = encodeURIComponent(item.split('=')[1]);
@rufus2021
rufus2021 / gist:135be77a40cbb732c714
Last active December 15, 2015 17:28
delete all local branches and save master and develop
git br | grep -Ev 'develop|master' | xargs git br -D // brute force
git br | grep -Ev 'develop|master' | xargs git br -d // preserver unmerged branches
Steps for creating a new branch, adding, commiting & pushing changes & creating a new pull request
NOTE: don't make commits directly to the develop branch.
step 1: git checkout develop - checks out the develop branch locally
step 2: git pull - gets you the latest updates for the repo
step 3: git checkout -b name bugfix/yaya-codes-awesome - create a new branch based off of develop