Skip to content

Instantly share code, notes, and snippets.

@petecoop
petecoop / gist:5867748
Last active December 19, 2015 00:19
Git SVN Switch
  • Edit the svn-remote url URL in .git/config to point to the new domain name
  • Run git svn fetch - This needs to fetch at least one new revision from svn!
  • Change svn-remote url back to the original url
  • Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation)
  • Change svn-remote url back to the new url
  • Run git svn rebase should now work again!
@petecoop
petecoop / compareimage.php
Last active May 16, 2023 08:53
Using PHP's GD library compares the similarity between 2 images with the same dimensions. This is based on the colour's in spread out positions and returns a rating out of 100.
<?php
function compareImages($imagePathA, $imagePathB, $accuracy){
//load base image
$bim = imagecreatefromjpeg($imagePathA);
//create comparison points
$bimX = imagesx($bim);
$bimY = imagesy($bim);
$pointsX = $accuracy*5;
$pointsY = $accuracy*5;
$sizeX = round($bimX/$pointsX);
@petecoop
petecoop / config.rb
Created November 10, 2012 00:15
Example Compass config
environment = :development
http_path = "/"
css_dir = "css"
sass_dir = "css"
images_dir = "img"
add_import_path "/Users/pete/play/sass"
@petecoop
petecoop / unzip.php
Created October 29, 2012 09:59
PHP - unzip to cwd
<?php
$zipfile = (isset($_GET['z'])) ? $_GET['z'] : false;
if($zipfile){
$zip = new ZipArchive;
$res = $zip->open($zipfile);
if($res === true){