Skip to content

Instantly share code, notes, and snippets.

@marcuslilja
marcuslilja / install-unifi-controller-ubuntu.md
Last active April 6, 2016 05:34
How to install Unifi controller on Ubuntu 15.10

Add source

echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | sudo tee -a /etc/apt/sources.list.d/100-ubnt.list

Add keys

@marcuslilja
marcuslilja / react-examples.js
Last active April 7, 2016 11:49
Simple React Examples
import React from 'react';
class Section extends React.Component {
render () {
return (
<div className="section">
{React.Children.map(this.props.children, (child) => {
return <div className="section__main">{child}</div>;
})}
@marcuslilja
marcuslilja / doubleend.zsh-theme
Created September 14, 2015 09:44
Doubleend theme for zshell
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
function get_pwd() {
print -D $PWD
}
function battery_charge() {
@marcuslilja
marcuslilja / how-to-create-a-local-scoped-npm-module.md
Created August 10, 2015 14:06
How to create a local scoped npm module

How to create a local scoped npm module

  1. The main file of the module should be named index.js.
  2. Initialize the module by running npm init --scope=<your-scope>.
  3. Install local module with npm install --save <path-to-module>.

Example

Local module resides in lib/custom-module, the scope of the module should be marcuslilja.

@marcuslilja
marcuslilja / react-components.md
Last active August 29, 2015 14:21
Thoughts on React components.

React components

  • Single responsibility
  • Optional props to alter styling
  • Skip having lists as props

Examples

Basic folder structure.

@marcuslilja
marcuslilja / ubuntu-server-setup-16.04.md
Last active January 30, 2020 23:28
Server setup for Ubuntu 16.04 on Digital Ocean

Server setup for Ubuntu 16.04 on Digital Ocean

The setup installs the following software:

  • Nginx
  • MySQL
  • PHP
  • Node
  • Composer
@marcuslilja
marcuslilja / deprecate-repository.sh
Created April 8, 2014 21:16
Save a repository as deprecated.
repo_destiny -> marcuslilja/deprecated
repo_source -> marcuslilja/my-repository
git clone git@github.com:${repo_source}.git
git clean -fd
git reset --hard
git checkout master
git pull -f origin master
git checkout -B ${repo_source}
git push -f git@github.com:${repo_destiny}.git ${repo_source}
@marcuslilja
marcuslilja / httpd-vhosts.conf
Last active August 29, 2015 13:57
Apache Virtual Host Config
<VirtualHost *:80>
DocumentRoot "<path-to-project>"
ServerName <site-name>.dev
ServerAlias *.<site-name>.dev
ErrorLog "/private/var/log/apache2/<site-name>.dev-error_log"
CustomLog "/private/var/log/apache2/<site-name>.dev-access_log" common
<Directory "<path-to-project>">
@marcuslilja
marcuslilja / clean-osx-install.md
Last active September 21, 2023 08:02
Clean Install – macOS Mojave (10.14)

macOS Mojave (10.14)

To be able to install all applications. We need to unlock the "Anywhere" setting in Gatekeeper.

sudo spctl --master-disable

Applications

@marcuslilja
marcuslilja / create-boilerplate.sh
Last active December 22, 2015 22:49
Simple bash script to clone repository boilerplate repository and remove .git folder inside. Timesaver when creating new projects.
#!/bin/sh
# Store the git repository url
REPOSITORY="git@github.com:marcuslilja/html5-boilerplate-grunt.git"
# Fetch all arguments
args=("$@")
# Count the number of arguments
number_of_arguments=${#args[@]}