Skip to content

Instantly share code, notes, and snippets.

View janlis-ff's full-sized avatar

Jan Lis janlis-ff

View GitHub Profile
@mikecao
mikecao / md5
Created January 30, 2014 06:19
Single function implementation of MD5 in Javascript
function md5(str) {
var i, j,
bytes = [],
words = [],
hex = [];
var Y = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21];
var Z = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
@bobmagicii
bobmagicii / gist:3107329
Created July 13, 2012 20:40
Setting image opacity in Imagick (good result)
<?php
function bob_opacity($img,$alpha) {
if(!is_object($img)) return false;
if($alpha > 1 || $alpha < 0) return false;
$rows = $img->getPixelIterator();
foreach($rows as $cols) {
foreach($cols as $pixel) {
// we now have an object pointing at a single pixel of the image