Skip to content

Instantly share code, notes, and snippets.

View Alanaktion's full-sized avatar
😫
tired af

Alan Alanaktion

😫
tired af
View GitHub Profile
@Alanaktion
Alanaktion / ios5.html
Last active November 7, 2015 17:50
iOS 5 UI in CSS
<!DOCTYPE html>
<html>
<head>
<title>iOS 5</title>
<style type="text/css">
body {
margin: 0;
font-family: 'Helvetica Neue', Arial, sans-serif;
background-image: url("data:image/gif;base64,R0lGODlhCgAKAIABAN3d3f///yH5BAEKAAEALAAAAAAKAAoAAAIRjA2Zhwoc3GMSykqd1VltzxQAOw==");
background-repeat: repeat;
@Alanaktion
Alanaktion / phproject-stats.sh
Created November 3, 2015 07:00
Phproject stat calculation
git ls-tree --name-only -z -r HEAD |\
grep -zZP '^(?!(lib|tmp|fonts|app/helper/(diff|textile))/)(?!(css|less|js)/(bootstrap|jquery|chart|respond|modernizr|datepicker|simplemde|intercom|stupidtable|typeahead|bootswatch)).*\.(php|css|less|js|html)$' |\
xargs -0 -n1 git blame --line-porcelain |\
grep \"^author \" | sort | uniq -c | sort -nr
@Alanaktion
Alanaktion / entropizer.php
Last active October 22, 2015 16:01
Simple PHP entropy calculator
<?php
/**
* Calculate entropy of a string
*
* @see https://github.com/jreesuk/entropizer
*
* @param string $str
* @return integer
*/
function entropizer($str) {
@Alanaktion
Alanaktion / setup-osx.sh
Created October 7, 2015 20:08
Auto-setup for OS X
#!/bin/bash
# Sets up a new OS X installation with reasonable defaults
# Based partially on https://gist.github.com/saetia/1623487
echo 'Setting defaults...'
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Set default Finder location to home folder (~/)
@Alanaktion
Alanaktion / goog.svg
Created September 16, 2015 22:32
A not-quite-accurate minimal SVG Google logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Alanaktion
Alanaktion / .bashrc
Last active August 29, 2015 14:26
Bash startup script
# Bash settings for ultimate happiness
# Cross-platform and full of hax
# ls aliases
alias ls='ls --color'
alias ll='ls -alhF'
alias la='ls -A'
alias l='ls -CF'
# Shortcuts
### Keybase proof
I hereby claim:
* I am alanaktion on github.
* I am alanaktion (https://keybase.io/alanaktion) on keybase.
* I have a public key whose fingerprint is F7D8 B00D 7324 35F9 42A9 352E 27A7 9A65 774B 4AF0
To claim this, I am signing this object:
@Alanaktion
Alanaktion / autosetup.sh
Last active August 29, 2015 14:15
Auto-setup an Ubuntu machine
#!/bin/bash
# Sets up a new Ubuntu installation with good things
# Desktop and Server are supported
# Detect Ubuntu version
distro="server"
(dpkg -s "ubuntu-desktop" && distro="ubuntu") > /dev/null 2>&1
(dpkg -s "xubuntu-desktop" && distro="xubuntu") > /dev/null 2>&1
(dpkg -s "kubuntu-desktop" && distro="kubuntu") > /dev/null 2>&1
@Alanaktion
Alanaktion / collatz.php
Last active August 29, 2015 14:11
Collatz conjecture test
<?php
/**
* Collatz Conjecture Test
*
* This will generate a file showing each step taken to reach 1 following
* the Collatz Conjecture with integers between 2 and 2^20. Note that the
* resulting file will be over 2 GB, so changing pow(2, 20) to a smaller
* number like pow(2, 16) may be preferable.
*
* @author Alan Hardman <alan@phpizza.com>
@Alanaktion
Alanaktion / gist:c00e13a2de0729ce63fc
Created November 28, 2014 22:00
Tiny PHP slugify function
<?php
function slugify($str) {
return trim(strtolower(preg_replace("/-+/", "-", preg_replace("/[^a-z0-9]/i", "-", $str))), "-");
}