Skip to content

Instantly share code, notes, and snippets.

View vlrmprjct's full-sized avatar
🎹
Boing boom tschak!

Thomas vlrmprjct

🎹
Boing boom tschak!
View GitHub Profile
@vlrmprjct
vlrmprjct / font-size.scss
Last active August 10, 2018 11:37
Viewport sized #typography with #minimum and #maximum values #fontsize #scss #css
///
/// Viewport sized typography with minimum and maximum values
///
/// @author Eduardo Boucas (@eduardoboucas)
///
/// @param {Number} $responsive - Viewport-based size
/// @param {Number} $min - Minimum font size (px)
/// @param {Number} $max - Maximum font size (px)
/// (optional)
/// @param {Number} $fallback - Fallback for viewport-
@vlrmprjct
vlrmprjct / pQuery.js
Created July 13, 2018 09:53 — forked from niyazpk/pQuery.js
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
@vlrmprjct
vlrmprjct / relativePath.js
Created July 3, 2018 08:37 — forked from eriwen/relativePath.js
Get relative file path in JavaScript
/**
* Given a source directory and a target filename, return the relative
* file path from source to target.
* @param source {String} directory path to start from for traversal
* @param target {String} directory path and filename to seek from source
* @return Relative path (e.g. "../../style.css") as {String}
*/
function getRelativePath(source, target) {
var sep = (source.indexOf("/") !== -1) ? "/" : "\\",
targetArr = target.split(sep),
@vlrmprjct
vlrmprjct / wsl_backup.sh
Last active June 16, 2018 13:25
WSL Backup #wsl #windows #linux #backup #tar
#!/bin/bash
#
cd /
tar -cvpzf /mnt/d/backup.tar.gz \
--exclude=/backup.tar.gz \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
@vlrmprjct
vlrmprjct / apache.sh
Last active June 8, 2018 11:38
apache2 - enabling and disabling sites #apache2 #apache #debian #linux #ubuntu #webserver
# enable site
sudo a2ensite
# disable site
sudo a2dissite
# enable an apache2 module
sudo a2enmod
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
@vlrmprjct
vlrmprjct / template
Last active June 3, 2018 14:11 — forked from gistwebdev/template
Apache 2 basic virtual host template
<VirtualHost template.url:80>
ServerAdmin template.email
ServerName template.url
DocumentRoot template.webroot
<Directory "template.webroot" >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
@vlrmprjct
vlrmprjct / vhost
Last active June 3, 2018 09:50 — forked from gistwebdev/vhost
Script to create apache2 virtual hosts #bash #linux #apache #wsl #host #vhost
#!/bin/bash
#
# Display usage info
vhost-usage() {
cat <<"USAGE"
Usage: vhost [OPTIONS] <name>
-h|--help this screen
-pub to create the webhost root in ~/www/name/public/
@vlrmprjct
vlrmprjct / Envy Code R Bold for Powerline.ttf
Created April 23, 2018 16:05
Envy Code R fonts patched for Powerline
@vlrmprjct
vlrmprjct / app.html
Created April 12, 2018 20:09 — forked from derekchiang/app.html
[electron]Use electron as a Web Server
<!doctype html>
<html><head><script src="app.js"></script></head><body></body></html>
@vlrmprjct
vlrmprjct / package.json
Created March 11, 2018 11:05 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",