Skip to content

Instantly share code, notes, and snippets.

View amiri's full-sized avatar

Amiri Barksdale amiri

View GitHub Profile
@amiri
amiri / gist:2294573
Created April 3, 2012 18:43
How I use setup/teardown for these
package CE::Selenium::FacebookRegistration;
use CE::Config;
use Test::Class::Most parent => 'CE::Test::Class::WWWSelDriver';
sub class {'CE'}
sub new_obj {
return shift;
}
@amiri
amiri / gist:1997939
Created March 8, 2012 01:47 — forked from ryannscy/gist:1997306
A tasks data structure
my $tasks = [
# Task 1
{ id => 1,
title => "Do stuff",
date_created => "2012-03-06 22:42:40",
date_modified => undef,
date_ended => undef,
priority_level => "2",
status_level => "active",
# Two goals for task 1
@amiri
amiri / gist:1453889
Created December 9, 2011 23:53
Possible regex mistake?
#!/usr/bin/perl
use strict;
use warnings;
my $original = "belize-i-27869844";
(my $original_regexed = $original) =~ s/^(.*)?-(\d+|i-[0-9a-f]{8})\b(.*)/$1-$3/;
print STDERR "My original regex turns $original into $original_regexed\n";
@amiri
amiri / gist:1249360
Created September 28, 2011 21:53
Login
package RoosterPirates::Web::Controller::Login;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
sub index : Chained('/') PathPart('login') Args('0') {
my ( $self, $c ) = @_;
$c->stash( template => 'login.tt2' );
@amiri
amiri / gist:1094007
Created July 19, 2011 23:30
Async fail
<script type="text/javascript">/* <[CDATA[ */
(function() {
var e = document.createElement('script'); e.type="text/javascript"; e.async = true;
e.src = document.location.protocol + '//platform.twitter.com/widgets.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(e);
Page.onReady('node-base', function(Y) {
twttr.events.bind('follow', function(event) {
console.log(event);
console.log("I got a follow!");
@amiri
amiri / gist:750583
Created December 21, 2010 20:53
Rewrite/redirect a POST with nginx?
server {
listen 80;
server_name blog.akbuntu.local;
location / {
default_type text/html;
root /home/amiri/roosterpirates/Ripe/RoosterPirates-Web/root/yar;
autoindex on;
expires 30d;
}
@amiri
amiri / gist:721030
Created November 30, 2010 02:23
inSeason.m
for (int i = 0; i < [inSeasonArray count]; i++) {
// check whether this green has 4 best seasons, and if so skip
NSLog(@"Here is the produceBest dictionary: ",[[inSeasonArray objectAtIndex:i] valueForKey:@"produceBest"] );
NSLog(@"Here is the number of items in produceBest dictionary: ",[[[inSeasonArray objectAtIndex:i] valueForKey:@"produceBest"] count] );
if ([[[inSeasonArray objectAtIndex:i] valueForKey:@"produceBest"] count] > 3) {
continue;
}
for (NSString *string in [[searchViewArray valueForKey:@"produceName"] filteredArrayUsingPredicate:predicate]) {
NSLog(@"During loop, my temp string is: %@",string);
[self.greensArray addObject:string];
}
NSLog(@"After assignment from temp, self.greensArray is: %@",self.greensArray);
NSMutableArray *tempGreens = [NSMutableArray array];
for (id object in [[searchViewArray valueForKey:@"produceName"] filteredArrayUsingPredicate:predicate]) {
NSString *mygreen = [NSString string];
mygreen = object;
NSLog(@"During loop, my temp string is: %@",mygreen);
[tempGreens addObject:mygreen];
}
NSLog(@"After loop my temp array is: %@",tempGreens);
self.greensArray = [self.greensArray arrayByAddingObjectsFromArray:tempGreens];
NSLog(@"After assignment from temp, self.greensArray is: %@",self.greensArray);
NSMutableArray *tempGreens = [NSMutableArray array];
for (id object in [[searchViewArray valueForKey:@"produceName"] filteredArrayUsingPredicate:predicate]) {
NSString *mygreen = [NSString string];
mygreen = object;
NSLog(@"During loop, my temp string is: %@",mygreen);
[tempGreens addObject:mygreen];
}
NSLog(@"After loop my temp array is: %@",tempGreens);