Skip to content

Instantly share code, notes, and snippets.

View lilith's full-sized avatar
🎯
Focusing

Lilith River lilith

🎯
Focusing
  • Imazen
  • Broomfield, CO
  • 22:22 (UTC -06:00)
View GitHub Profile
@lilith
lilith / import.rb
Created August 25, 2011 21:18
Wordpress Importer
# coding: utf-8
#1) Synchronize your blog comments with IntenseDebate
#2) Export an XML file from your existing blog. Leave it running, so that attachments can be downloaded.
#3) Rename the .xml file to 'wordpress.xml' and place in root of the new nesta website.
#4) Run the import
# This does a fast 'offline import'. Use this first to verify there are no errors
# ruby -r './import.rb' -e 'Nesta::WordpressImport.process(true)'
@lilith
lilith / formats.rb
Created September 19, 2011 16:12
Prototype extensible formats system for Nesta
module Nesta
module Formats
@preferred_mappings = Hash.new
@template_mappings = Hash.new { |h, k| h[k] = [] }
def self.extensions
@template_mappings.keys
end
def self.normalize(ext)
@lilith
lilith / freeimagetest.cs
Created September 21, 2011 16:57
Test of FreeImage performance
protected virtual bool BuildUnmanaged(object source, object dest, ResizeSettings settings) {
if (!FreeImageAPI.FreeImage.IsAvailable()) return false;
if (!"true".Equals(settings["freeimage"])) return false;
// Load the example bitmap.
FIBITMAP original = FIBITMAP.Zero;
FIBITMAP final = FIBITMAP.Zero;
if (source is String)
@lilith
lilith / JcropPreview
Created March 8, 2012 04:37
A tiny JQuery plugin that adds preview functionality to JCrop
/* A tiny jQuery plugin to provide live previews for Jcrop
Init by calling on an empty div which you'd like to contain the preview.
You can specify a width and height using the defaultWidth and defaultHeight settings, although CSS width/height specified on the div take precedence.
Ex:
$("div.preview").JcropPreview({ jcropImg: $("img.primaryImage") });
After initializing the preview, then you can start up Jcrop. If you don't have any special onSelect event handling to do, call $("div.preview").JcropPreviewUpdateFn() to create a handler for the event:
Ex.
@lilith
lilith / gist:2020938
Created March 12, 2012 09:39
Eye detection code
public string FaceCascade = @"haarcascade_frontalface_default.xml";
public string LeftEyeCascade = @"haarcascade_lefteye_2splits.xml";
public string RightEyeCascade = @"haarcascade_righteye_2splits.xml";
public string EyePair45 = @"hhaarcascade_mcs_eyepair_big.xml";
@lilith
lilith / boot-update.sh
Created June 1, 2012 00:08
Boot script for EC2 instances
#!/bin/sh
sudo yum update -y
cd /var/www/html/
#Update git repo and checkout the appropriate branch
if [ -r /var/www/html/.git/HEAD ]; then
su -s /bin/sh apache -c "git remote rm origin"
su -s /bin/sh apache -c "git remote add origin git@github.com:lensnetllc/direct-lens.git"
su -s /bin/sh apache -c "git pull origin master"
su -s /bin/sh apache -c "git checkout master"
15" MacBookPro with Retina Display
2.6GHz Quad-core Intel Core i7, Turbo Boost up to 3.6GHz
16GB 1600MHz DDR3L SDRAM
768GB Flash Storage
Apple USB SuperDrive
Backlit Keyboard (English) & User's Guide
AppleCare Protection Plan for 15" and 17" MacBook Pro and 15" MacBook Pro with Retina display - Auto-enroll
Apple Thunderbolt to Gigabit Ethernet Adapter
MagSafe to MagSafe 2 Converter
public void SetLastModified(DateTime date)
{
DateTime utcDate = DateTimeUtil.ConvertToUniversalTime(date);
this.UtcSetLastModified(utcDate);
}
private void UtcSetLastModified(DateTime utcDate)
{
utcDate = new DateTime(utcDate.Ticks - utcDate.Ticks % 10000000L);
if (utcDate > DateTime.UtcNow)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageResizer.Resizing;
using System.Drawing;
using ImageResizer.ExtensionMethods;
using ImageResizer.Util;
namespace ImageResizer.Plugins.CropAround {
using System;
using System.Collections.Generic;
using System.Text;
using ImageResizer.Configuration;
using System.Web.Hosting;
using System.Collections.Specialized;
namespace ImageResizer.Plugins.Basic {
/// <summary>
/// Adds URL syntax support for legacy projects: