Skip to content

Instantly share code, notes, and snippets.

@arminrosu
arminrosu / wp_sfs.js
Last active December 18, 2015 02:09
Lazy man's way of adding wordpress spam users to stopforumspam database
var key = '12345678901234';
jQuery('#the-list tr').each(function(){
$tr = jQuery(this);
var spammer = {
'username': $tr.find('.username a').first().text(),
'email': $tr.find('.email a').children().remove().end().text(),
'ip_addr': $tr.find('.signup_ip em').text(),
'api_key': key
@arminrosu
arminrosu / class.orphanfinder.php
Last active December 15, 2015 10:19
Parse css for orphan images (i.e. on disk but not in css)
<pre><?php
class OrphanFinder {
private $imagesDir = "";
private $imagesUrl = ""; // base path
private $stylesheetsDir = "";
function __construct($imagesDir, $imagesUrl, $stylesheetsDir) {
$this->imagesDir = $imagesDir;
$this->imagesUrl = $imagesUrl;
@arminrosu
arminrosu / base64_encode_images
Last active June 6, 2016 22:05
Batch base64 encode images in a directory for CSS
<pre><?php
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* Batch base64 encode images and output css
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
// list images in ./images/ directory
$directory = dirname(realpath(__FILE__));
$images_dir = $directory . '/images/';
$images = get_images($images_dir);