Skip to content

Instantly share code, notes, and snippets.

View lukasni's full-sized avatar

Lukas Niederberger lukasni

  • Nanaimo, BC, Canada
View GitHub Profile
@lukasni
lukasni / footer-test.html
Created October 7, 2013 20:56
Basic HTML/CSS to create a page with 100% min-height and a fixed footer that will always need to be scrolled in.
@lukasni
lukasni / blog.mustache
Last active December 29, 2015 07:59
A basic example of using Mustache subtemplates.
<div class="blog">
<header>
<h1>{{blog_title}}</h1>
</header>
{{#articles}}
<article class="blog-article">
<header><h2>{{title}}</h2></header>
<section class="blog-body">
{{{body}}}
<?php
// Password generator function
function passwordGen($num, $length, $inclBigLetters = true, $inclSmallLetters = true, $inclNumbers = true, $inclSpecialChars = false) {
$bigLetters = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
$smallLetters = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
$numbers = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$specialChars = array("$", "_", "+", "-", "/", "*", "=", "(", ")");
$result = array();
$characterSet = array();
@lukasni
lukasni / 0: original_query.sql
Last active March 18, 2016 12:19
Average messages by hour
SELECT ROUND(AVG(a.posts)) "Posts (avg)", post_hour
FROM (
SELECT count(id) posts, DATE(post_date) dateonly, EXTRACT(hour FROM post_date) post_hour
FROM message
GROUP BY post_hour, dateonly
) a
GROUP BY post_hour
ORDER BY post_hour;
@lukasni
lukasni / pre-commit.sh
Created January 18, 2019 16:16
git pre-commit hook for Elixir running format check, tests and credo.
#!/bin/bash
#
# Linter Elixir files using Credo.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# Config
# ------
# credo.terminate
# The credo exit status level to be considered as “not passed”—to prevent
# git commit until fixed.