Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zefer on github.
  • I am zefer (https://keybase.io/zefer) on keybase.
  • I have a public key whose fingerprint is F567 C5FD F4C4 6609 D9C6 D3D8 69F5 6243 1352 83C0

To claim this, I am signing this object:

<?xml version="1.0"?>
<project basedir="." default="build">
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="lib/compiler.jar"/>
<target name="build" depends="combineJs">
</target>
<target name="combineJs">
<cffunction name="allowCrossDomainAccess" returnType="void" access="public">
<cfset var stHeaders = getHttpRequestData().headers />
<cfif structKeyExists( stHeaders, "Origin" ) and cgi.request_method eq "OPTIONS">
<!---
Preflighted requests:
1. browser tells us it wants to make a non-basic x-domain request. Non-basic could mean it is a PUT, or contains custom headers, or a different content-type
2. based on what the browser tells us it wants to do, we respond and tell it what x-domain requests we allow
<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
@zefer
zefer / TimeSpanNativeCfmlCache.cfc
Created November 1, 2010 18:09
some minor fixes
<!---
Mach-II - A framework for object oriented MVC web applications in CFML
Copyright (C) 2003-2010 GreatBizTools, LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@zefer
zefer / ConsumerDAO.cfc
Created December 17, 2010 15:05
An example DAO using cfmongodb. The model object is an API consumer.
<cfcomponent extends="beans.model.AbstractServiceObject" output="false" hint="">
<cffunction name="init" access="public" output="false" returntype="beans.model.ConsumerDAO">
<cfscript>
// something random to append to passwords to prevent reverse md5 lookups
variables.salt = "_8sh3m9cc"
super.init( argumentcollection: arguments );
@zefer
zefer / get_currently_playing_via_lastfm.sh
Created January 26, 2011 15:12
queries last.fm and returns the currently playing song
#!/bin/bash
LASTFMUSER=${1:-"default_user_name"}
echo $LASTFMUSER ...
curl -s http://www.last.fm/user/$LASTFMUSER | grep -A 1 subjectCell | sed -e 's#<[^>]*>##g' | head -n2 | tail -n1 | sed 's/^[[:space:]]*//g' | cowsay
@zefer
zefer / .gitconfig
Created February 22, 2011 11:20
config to use SmartSynchronize as a Git diff-viewer
[diff]
tool = smartsynchronize
[difftool "smartsynchronize"]
cmd = /Applications/SmartSynchronize.app/smartsynchronize.sh "$LOCAL" "$REMOTE"
[difftool]
prompt = false
@zefer
zefer / full_nginx_s3_proxy.conf
Created March 9, 2011 10:33
my full conf for allowing S3 CORS file uploads
# DO NOT RESPOND TO REQUESTS OTHER THAN upload.xxx.ly AND upload.xxx.com
server {
listen 80 default;
server_name _;
return 444;
}
# FILE UPLOADS
server {
listen 80;
c = 'ffffff'
canvas_image = Magick::Image.new(w, h) {
self.background_color = c
}