Skip to content

Instantly share code, notes, and snippets.

@mindfullsilence
mindfullsilence / getLinkParams.js
Created September 5, 2015 22:11
Get url parameters as as a JS Location object complete with query params
/**
* Created by Tim on 9/5/15.
* Special thanks to James Padolsey:
* http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
*
* Seriously, why didn't I think of that???
*
* Pretty much the same code as link above. Cleaned up the regex a bit to avoid
* false errors in IDEs. Added some checks so we default to the document
* location if nothing is passed. I also check to see if the string passed is a
@mindfullsilence
mindfullsilence / flexbox-doc.less
Last active June 21, 2016 23:36
A bootstrap cross browser flexbox grid system. Browser support: IE 11, Edge|Everyone else
/**
* First, make sure you're importing bootstraps normal grid system. Then include
* this file AFTER bootstrap.
* You MUST use autoprefixer during compile time to be cross-browser compat.
*
* The .flex class can only be used on the bootstrap .row class. The .row.flex
* element should only container bootstrap columns. The columns can contain
* whatever you want, but don't have anything as a direct decendant of the
* .row.flex that is not a bootstrap column or shit begets cray cray.
*/
@mindfullsilence
mindfullsilence / script.js
Last active March 19, 2016 17:57
Simple Javascript Class Extension Factory
var Zion = function() {
var ret;
if(this instanceof Window) {
ret = new Zion();
}
else ret = this;
return ret
};
Zion.prototype.extend = function() {
@mindfullsilence
mindfullsilence / createmarker.js
Last active August 12, 2016 20:05
Dynamic Google Map Marker Icon
// The Template
var marker_template = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="35px" viewBox="0 0 30 49" style="enable-background:new 0 0 30 49;" xml:space="preserve"><path class="marker-background" fill="[[ bg ]]" d="M15,48.5c-1.1-5.5-3.1-10-5.4-14.2c-1.8-3.1-3.8-6-5.7-9c-0.6-1-1.2-2.1-1.8-3.1 c-1.2-2.1-2.2-4.5-2.1-7.7C0.1,11.4,1,9,2.2,6.9c2.1-3.3,5.7-6,10.4-6.8c3.9-0.6,7.5,0.4,10.1,1.9c2.1,1.2,3.7,2.9,5,4.8 c1.3,2,2.2,4.4,2.3,7.5c0,1.6-0.2,3.1-0.6,4.3c-0.4,1.2-1,2.3-1.5,3.4c-1,2.2-2.4,4.2-3.7,6.1C20.3,34.2,16.6,40.3,15,48.5z"/><circle class="marker-circle" fill="[[ circle ]]" cx="15" cy="15" r="5"/><text class="marker-text" x="15" y="22" text-anchor="middle" fill="[[ textColor ]]" font-family="MyriadPro-Regular" font-size="18">[[ text ]]</text></svg>';
// Creating a marker
var icon = marker_template
.replace('[[ bg ]]', '') // some hex color
.replace('[[ circle ]]', '') // some hex color
.replace('[[ text ]]
/* dockter eval
namespace: components
name: [{[Component name]}]
description: [{[Description]}]
file: [{[Component name]}].less
require:
- jquery
endeval */
@mindfullsilence
mindfullsilence / README.md
Last active October 4, 2017 22:56
Creates a triangle with fill and stroke on any side(s) you want.

Use the mixin inside of a ::before or ::after pseudo element.

E.g.:

div::before {
  @include svg-triangle(
    $width: 30px, // any unit
    $height: 20px, // any unit
    $borders: left right, // left, right, bottom, or any combination of the 3
 $border-color: #cccccc, // hex
@mindfullsilence
mindfullsilence / wp-end-maintainance.sh
Last active July 16, 2018 17:18
Bash scripts to start and stop maintainance mode for wordpress.
#!/usr/bin/env bash
WP_WEB_ROOT=/var/www/html;
cd $WP_WEB_ROOT;
# Disable maintainance mode by removing the .maintainance file
rm -f $WP_WEB_ROOT/.maintainance;
# Flush caches
@mindfullsilence
mindfullsilence / KeepsHistory.js
Last active March 10, 2021 17:38
Object history tracking mixin with undo and redo abilities
const log = Symbol('log')
const present = Symbol('present')
const observer = Symbol('observer')
const real = Symbol('real')
const KeepsHistory = superclass => class extends superclass {
;[log] = []
;[present] = null
;[observer] = undefined
;[real] = undefined
@mindfullsilence
mindfullsilence / README.md
Last active February 12, 2024 20:50
Root Bedrock Homestead site-type

This script will create a roots/bedrock project in your desired directory, install composer dependencies, and install wordpress via the wp-cli tool. Works with mailhog.

For global homestead installations (not per-project installs)

Place the sh file in Homestead/scripts/site-types/

In your Homestead.yaml file, use "bedrock" as the type key for a site mapping, and the value of the map key as the database. Be sure to add /web to the end of your to: key for your folder mapping. The script will generate the web folder for you. E.g.:

---
@mindfullsilence
mindfullsilence / quickmount.md
Last active June 13, 2020 22:16
Mount synology nas on Mac through bash

Installation

  1. Copy the contents of the quickmount.sh file to your ~/.bash_profile
  2. Edit lines 4, 5, and 6 with the appropriate information for connecting to your synology NAS
  3. Edit/duplicate the projects function for any folders you want to mount on your mac.
  4. Save your ~/.bash_profile, then in terminal run source ~/.bash_profile

Usage

To mount a directory from terminal, just call your function: