Skip to content

Instantly share code, notes, and snippets.

@CosAnca
CosAnca / gb-clean.sh
Created February 10, 2018 08:39
Remove local branches that are no longer remote
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@CosAnca
CosAnca / urlParameters.js
Created January 16, 2018 13:31
Get URL query parameters
const queryParam = new URLSearchParams(document.location.search).get('foobar');
@CosAnca
CosAnca / mixin.pug
Created November 3, 2017 20:09 — forked from keyurshah/mixin.pug
[Responsive image] html5 responsive image mixin #pug #mixin #html5
- src = "" // !
mixin respImage
- var src1 = src.replace(/(\.[\w\d_-]+)$/i, "@medium$1") + " " + size + "w"
- var src2 = src.replace(/(\.[\w\d_-]+)$/i, "@large$1") + " " + size * 1.5 + "w"
- var src3 = src.replace(/(\.[\w\d_-]+)$/i, "@huge$1") + " " + size * 2 + "w"
img(class = imgClass
srcset = src1 + ", " + src2 + ", " + src3
sizes = sizes
@CosAnca
CosAnca / blockquote-cite-tinymce.js
Created October 23, 2017 11:02 — forked from stephanieleary/blockquote-cite-tinymce.js
Blockquote + Cite TinyMCE button JS
(function() {
tinymce.PluginManager.add('blockquote_cite', function( editor, url ) {
editor.addButton( 'blockquote_cite', {
title: 'Blockquote & Cite',
icon: "icon dashicons-testimonial",
onclick: function() {
editor.windowManager.open( {
title: 'Insert Blockquote and Citation',
body: [
{
@CosAnca
CosAnca / createdb.sh
Last active September 20, 2017 13:17
Fosterkit WP database
#!/usr/bin/env bash
#
# WordPress setup
#
# Author: Cos Anca
# ERROR Handler
# ask user to continue on error
function continue_error {
read -p "$(echo -e "${RED}Do you want to continue anyway? (y/n) ${NC}")" -n 1 -r
@CosAnca
CosAnca / sendfile.sh
Created September 18, 2017 21:40 — forked from falexandrou/sendfile.sh
Turn Sendfile to "off" for vagrant boxes
# A VirtualBox bug forces vagrant to serve
# corrupt files via Apache or nginx
# The solution to that would be to turn off
# the SendFile option in apache or nginx
#
# If you use apache as your main web server
# add this directive in your httpd.conf (or apache.conf)
# configuration file name may vary in various systems
#
EnableSendfile off
@CosAnca
CosAnca / .hyper.js
Created September 7, 2017 11:00
My Hyper config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: '"SF Mono", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@CosAnca
CosAnca / bash-cheatsheet.sh
Created August 31, 2017 14:18 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@CosAnca
CosAnca / movegfjstofooter.php
Created August 22, 2017 12:59 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );
@CosAnca
CosAnca / sass-convert
Created April 25, 2017 14:16
Convert SASS to SCSS and delete .sass files (applies to all files in current folder)
sass-convert -R ./ -F sass -T scss && find . -type f -name '*.sass' -delete