Skip to content

Instantly share code, notes, and snippets.

View mortennajbjerg's full-sized avatar

Morten Najbjerg mortennajbjerg

View GitHub Profile
@mortennajbjerg
mortennajbjerg / gist:2020940
Last active October 1, 2015 16:08
jQuery HTML5 Placeholder fallback
(function($) {
'use strict';
/*global jQuery*/
/*global document*/
$(function() {
// Make sure this only applies to browsers
// without placeholder support
if (document.createElement("input").placeholder !== undefined) { return false; }
@mortennajbjerg
mortennajbjerg / find-changed-lines-of-codes-in-git
Created October 31, 2013 12:01
Return the created & deleted lines of code + the changed files within a certain time in GIT
git log --shortstat --since "2 weeks ago" --until "now" -p ./ | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
var gulp = require('gulp');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var coffee = require('gulp-coffee');
var stylus = require('gulp-stylus');
// Copy assets
gulp.task('assets', function() {
gulp.src('client/assets/**')
@mortennajbjerg
mortennajbjerg / Installing Drush on Hetzner managed server
Last active January 28, 2022 10:27
Installing Drush on Hetzner managed server
# Installing Composer
mkdir ~/bin
mkdir ~/bin/composer
cd ~/bin/composer
wget https://getcomposer.org/composer.phar --no-check-certificate
php composer.phar init --author "Morten Najbjerg <[email protected]>"
# Installing drush and setting up alias
echo "export COLUMNS" >> ~/.bashrc
echo "alias composer='php -d allow_url_fopen=on ~/bin/composer/composer.phar'" >> ~/.bashrc
# 1. Run key generator on deployment server
ssh-keygen
# 2. Copy the content of id_rsa.pub usin VIM
vim ~/.ssh/id_rsa.pub
# 3. Add the id_rsa.pub to Deployment keys in Bitbucket
# 4. Add Bitbucket to known_hosts on deployment server
ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts
@mortennajbjerg
mortennajbjerg / Install WP CLI on Hetzner Managed Server
Created June 11, 2018 13:15
Install WP CLI on Hetzner Managed Server
mkdir ~/bin
mkdir ~/bin/wp-cli
cd ~/bin/wp-cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
echo "export COLUMNS" >> ~/.bashrc
echo "alias wp='php ~/bin/wp-cli/wp-cli.phar'" >> ~/.bashrc
echo "alias php='/usr/bin/php'" >> ~/.bashrc
source ~/.bashrc
echo "PATH=$HOME/bin:$PATH" >> ~/.bashrc
@mortennajbjerg
mortennajbjerg / inviewtailwind.js
Created March 11, 2022 10:26
JS Helper for InViewport & Tailwind animations
import inViewport from 'in-viewport';
/**
* Use like this:
*
* <div class="transition duration-500" data-inview-before="opacity-0" data-inview-after="opacity-100">Fade me in</div>
*/
document.addEventListener('DOMContentLoaded', () => {
var inviewEls = document.querySelectorAll('[data-inview');