Skip to content

Instantly share code, notes, and snippets.

View kivlor's full-sized avatar

Andrew Gallagher kivlor

View GitHub Profile
<?php
function encode_ean13($number)
{
// String it and make it the right length
$digits = (string)$number;
$digits = strlen($digits) < 12 ? str_pad($digits, 12, '0', STR_PAD_LEFT) : $digits;
// Add the values of the digits in the even-numbered positions: 2, 4, 6, etc.
$even_sum = $digits{1} + $digits{3} + $digits{5} + $digits{7} + $digits{9} + $digits{11};
@kivlor
kivlor / block_ascii.txt
Last active December 21, 2015 20:59
A bunch of block ascii. Perfect for your motd file ( ^__^)b
Sonic:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒████▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ░░
▒▒▒▒░░░░░░░░░░██▒▒▒▒██████▒▒▒▒░░░░░░
▒▒░░░░░░░░░░▒▒░░██▒▒▒▒████████▒▒░░░░
░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒████████▒▒░░
░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒██████████▒▒
░░░░░░░░░░▒▒▒▒▒▒░░░░▒▒████████▒▒
░░░░░░▒▒▒▒▒▒░░▒▒▒▒░░▒▒▒▒██▒▒▒▒▒▒
@kivlor
kivlor / Preferences.sublime-settings
Last active December 17, 2015 12:09
sublime settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/Tomorrow-Night-Bright.tmTheme",
"file_exclude_patterns":
[
".DS_Store",
"._.DS_Store",
"*.swp",
"*.swo"
],
function(k, v) {
return v.a ? v.a.map(function(x) {
return x.k
}) : [v.k]
}
@kivlor
kivlor / codepen.php
Last active September 17, 2021 23:22
PHP Code Pen
<?php
/*
This is a very dirty implementation of a 'code pen' for quickly testing small snippets of PHP code.
- It will eval anything and everything entered into the code field
- It should only ever be used on a local machine, never on the dev servers and espiacally never on a live server
USE WITH CAUTION!
@kivlor
kivlor / gist:2232687
Created March 29, 2012 02:39
Find files and copy to destination
find . -name '*.html' | xargs -I {} /bin/cp {} /copy/to/destination/
/*
Uploadify v2.1.4
Release Date: November 8, 2010
Copyright (c) 2010 Ronnie Garcia, Travis Nickels
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell