Skip to content

Instantly share code, notes, and snippets.

git config --global alias.s status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.new checkout -b
git config --global alias.recent 'for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"'
// Convert contentful CLI export to markdown with node
const slugify = require('slugify')
const fs = require('fs')
const data = require('./data.json')
const sanatiseFields = fields => {
return Object.keys(fields).reduce((prev, next) => {
prev[next] = fields[next]['en-US'] ? fields[next]['en-US'] : fields[next]
return prev
module.exports = {
rules: {
'at-rule-empty-line-before': [
'always',
{
except: [
'blockless-after-same-name-blockless',
'blockless-after-blockless',
'first-nested'
],
valid_url = new RegExp(
"^" +
"(?:" +
// $1 protocol
"([a-z\\u00a1-\\uffff0-9]+-?)?" +
"(?:(?:\\:)?//)"+
// $2 username:password
"(?:((?:\\S*)(?::\\S*)?)@)?" +
// $3 Hostname
"("+
/* To add more icons just copy these three lines */
.icon-tomato,
.icon-left-tomato:before,
.icon-right-tomato:after{
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/131442/tomato.svg);
}
@MadeByMike
MadeByMike / bling.js
Last active July 23, 2021 12:32 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, delegate, fn) {
var f
var target = this, match = false
var matches = this.matchesSelector || this.mozMatchesSelector || this.webkitMatchesSelector || this.oMatchesSelector || (function (name) {
$(name).forEach(function (elm) {
if (elm === target){
@MadeByMike
MadeByMike / highlight-words-in-html.js
Last active February 15, 2018 05:24
Highlighting a sentence in HTML without destroying the markup around it is exceptionally hard!!!
/*!
* Highlight words in html - v0.0.1 - 2015-04-29
* http://madebymike.com.au
* Copyright (c) 2015 Mike Riethmuller; Licensed MIT
*/
/*
* It turns out that annotating a phrase within HTML is exceptionally hard. I've done it so you don't have to.
* The function accepts a phrase (string), HTML (string), and optionally a classname (string)
* It returns the same HTML with <mark> elements surrounding the phrase
var src = 'data:image/jpg;base64,/9j/4Q4kRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAiAAAAcgEyAAIAAAAUAAAAlIdpAAQAAAABAAAAqAAAANQACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpADIwMTQ6MTI6MjAgMTE6NDk6MzIAAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAjCgAwAEAAAAAQAAATsAAAAAAAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABIgEbAAUAAAABAAABKgEoAAMAAAABAAIAAAIBAAQAAAABAAABMgICAAQAAAABAAAM6gAAAAAAAABIAAAAAQAAAEgAAAAB/9j/7QAMQWRvYmVfQ00AAf/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwPFRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAFoAoAMBIgACEQEDEQH/3QAEAAr/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEFAQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMicYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcGBTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiP
<select>
<option value="NSW">New South Wales</option>
<option value="VIC">Victoria</option>
<option value="QLD">Queensland</option>
<option value="WA">Western Australia</option>
<option value="SA">South Australia</option>
<option value="TAS">Tasmania</option>
<option value="ACT">Australian Capital Territory</option>
<option value="NT">Northern Territory</option>
</select>
@MadeByMike
MadeByMike / jquery-merge-objects
Last active August 29, 2015 14:05
jQuery.mergeObjects()
(function($) {
$.mergeObjects = function(objects, merge_cb) {
var options, name, src, copy, copyIsArray, clone,
target = objects[0] || {},
i = 1,
length = objects.length;
// Handle case when target is a string or something
if ( typeof target !== "object" && !$.isFunction(target) ) {
target = {};