Skip to content

Instantly share code, notes, and snippets.

@4lun
4lun / bem-grid.scss
Last active August 29, 2016 09:53
Basic BEM CSS Grid
$breakpoint-lrg: 780px;
$breakpoint-med: 450px;
$grid-gutter: 15px;
.grid {
@extend %clearfix;
margin-left: -($grid-gutter);
&__col {
float: left;
@4lun
4lun / reddit-unsubscribe-all-subreddits.js
Last active January 7, 2025 17:28
Unsubscribe from all subreddits
// Visit https://www.reddit.com/subreddits/ and run the following in console (browser dev tools)
// Wait until all the buttons have visibly toggled, refresh page to confirm.
$('.fancy-toggle-button .remove').each(function(i, elem) { setTimeout(function(){ $(elem).trigger('click'); }, i*500) });
@4lun
4lun / course-structure-msccs-birkbeck.md
Last active August 14, 2024 17:44
Course Structure - Computer Science (MSc) at Birkbeck University, London
@4lun
4lun / 2015_12_21_172600_add_additional_session_columns_for_laravel_5-2.php
Created January 6, 2016 11:35
Upgrade to Laravel 5.2: Migration for sessions table
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdditionalSessionColumnsForLaravel52 extends Migration
{
/**
* Run the migrations.
*/
@4lun
4lun / piwik.local
Last active January 2, 2016 14:56
Piwik nginx config (including way to rename piwik client files)
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/piwik;
index index.php index.html index.htm;
server_name piwik.local;
location / {
@4lun
4lun / aws-upload-ssl-certificate.sh
Created December 18, 2015 12:45
Upload SSL certificate to AWS IAM for use with Cloudfront
aws iam upload-server-certificate --server-certificate-name domain_com --certificate-body file:///absolute/path/domain_com.crt --private-key file:///absolute/path/domain_com.key --certificate-chain file:///absolute/path/domain_com.ca-bundle --path /cloudfront/static/
@4lun
4lun / unifi.sh
Last active December 17, 2015 15:55
Start UniFi Controller from CLI (OSX)
cd /Applications/UniFi.app/Contents/Resources;
java -jar /Applications/UniFi.app/Contents/Resources/lib/ace.jar ui
@4lun
4lun / index.php
Created December 7, 2015 16:28
Simple script to help demo load balancing.
<?php
$id = sha1(getenv('HOSTNAME'));
function rgbcode($id){
return '#'.substr(md5($id), 0, 6);
}
?><html>
<style>
body { padding: 30px; background-color: <?php echo rgbcode($id); ?>; font-family: sans-serif; }
h1 { background: #000; color: #fff; margin: 0; padding: 5px; float: left; }
@4lun
4lun / cmus-osx.md
Last active February 20, 2016 14:57
cmus on OSX (inc. mediakeys and lastfm integration)

cmus

Install

brew install cmus

cmusfm

Install

git clone [email protected]:Arkq/cmusfm.git

cd cmusfm

@4lun
4lun / log_deprecated_method.helpers.php
Created October 16, 2015 10:45
Laravel helper log_deprecated_method
<?php
/**
* Writes to the log that a deprecated method was called, and where it was called from.
*/
function log_deprecated_method()
{
list($x, $current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
$currentMethod = (isset($current['class']) ? $current['class'].'::' : '').$current['function'].'()';
$callerMethod = (isset($caller['class']) ? $caller['class'].'::' : '').$caller['function'].'()';