Skip to content

Instantly share code, notes, and snippets.

View seanmccann's full-sized avatar
🏋️

Sean McCann seanmccann

🏋️
View GitHub Profile
@seanmccann
seanmccann / gist:53225
Created January 27, 2009 07:24
PHP lint checker -- use in svn pre-commit hook. This prevents code with basic parse errors from entering the repository
# originally from Joe Stump at Digg
for i in `$SVNLOOK changed -t "$TXN" "$REPOS" | /usr/bin/awk '{print $2}'`
do
if [ ${i##*.} == php ]; then
CHECK=`$SVNLOOK cat -t "$TXN" "$REPOS" $i | /usr/bin/php5 -d html_errors=off -l || echo $i`
RETURN=`echo $CHECK | /bin/grep "^No syntax" > /dev/null && echo TRUE || echo FALSE`
if [ $RETURN = 'FALSE' ]; then
echo $CHECK 1>&2;
exit 1
# Lo-fi client for the Facebook API. E.g.:
#
# fb = FacebookClient.new(:api_key => 'api-key', :secret => 'secret')
# fb.call 'users.getInfo', :session_key => 'session-key', :uids => 'user-id', :fields => 'birthday'
#
# by Scott Raymond <[email protected]>
# Public Domain.
#
class FacebookClient
def initialize(default_params={})
<?php
// list of words to find in string
$words = array('barack obama', 'chicago', 'nba');
// string to search
$sentence = "Barack Obama is from Chicago. Barack Obama's favorite food it pizza.";
$res = array(); // results array
server {
listen 80;
server_name stu.mp;
# if the request uri was a directory, store the index page name
if ($request_uri ~ /$) {
set $store_extra index.html;
}
# proxy module defaults
class User < ActiveRecord::Base
acts_as_authentic
validates_format_of :username, :with => /\A[\w-]+\Z/
validate :username_is_not_a_route # prevents usernames that are existing routes
protected
def username_is_not_a_route
path = ActionController::Routing::Routes.recognize_path("/#{username}", :method => :get) rescue nil
<div class="postauthor ">
<div style="float:left;margin:4px"><?php echo get_avatar( get_the_author_email(), '80' ); ?></div>
<h4><?php the_author_posts_link(); ?></h4>
<?php the_author_description(); ?>
</div>
$('a').dblclick(function() {
$('body').fadeOut("500000");
});
@seanmccann
seanmccann / forward.xml
Created June 5, 2012 17:02
Twilio Phone Forwarding
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial timeout="10">555-555-5555</Dial>
</Response>
curl -d "id=13765" http://cssdesignawards.com/vote_likes.php