Skip to content

Instantly share code, notes, and snippets.

View bryanhelmig's full-sized avatar
Zapier is hiring!

Bryan Helmig bryanhelmig

Zapier is hiring!
View GitHub Profile
fields = ['user_name']
cur.execute("SELECT {0} FROM users LIMIT 10".format( ','.join(fields) ))
for r in cur:
pairs = zip(fields, r)
self.write(r[0] + '<br />')
@bryanhelmig
bryanhelmig / index.coffee
Created February 1, 2012 16:13
Simple Node.js Jabber/AIM message sending API.
util = require "util"
xmpp = require "node-xmpp"
oscar = require 'oscar'
express = require "express"
###
The XMPP bot.
###
@bryanhelmig
bryanhelmig / index.coffee
Created February 2, 2012 23:57
Simple Node.js Jabber/AIM REST API.
util = require "util"
xmpp = require "node-xmpp"
oscar = require 'oscar'
express = require "express"
###
The XMPP bot.
###
initRules: () ->
# Rules are children of reads. Setup the @rules collection, set a URL on the collection.
# then fetch all the children from the api
@rules = new Rules({})
@rules.urlRoot = "#{@url()}/rules"
<?php
/**
* Validate Email Addresses Via SMTP
* This queries the SMTP server to see if the email address is accepted.
* @copyright http://creativecommons.org/licenses/by/2.0/ - Please keep this comment intact
* @author [email protected]
* @contributers [email protected]
* @version 0.1a
*/
@bryanhelmig
bryanhelmig / examples.js
Created March 21, 2012 03:02
EmailPie Samples
// An invalid domain.
// http://emailpie.com/v1/[email protected]
{
"didyoumean": null,
"errors": [
{
"message": "No MX records found for the domain.",
"severity": 7
}
➜ ~ ab -c 50 -n 1000 http://emailpie.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking emailpie.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
@bryanhelmig
bryanhelmig / py.py
Created May 15, 2012 17:54
queue examples
# bad way
def new_message(request):
user = get_user_or_404(request)
message = request.POST.get('message', None)
if not message:
raise Http404
user.save_new_message(message)
first = 1, 2, 3
second = 1, null, null
result = _.all _.zip(first, second), (li) ->
if not li[1]?
return true
else if li[0] == li[1]
return true
else
return false
#!/usr/bin/python
"""
first, install requests and oauth hook:
> sudo pip install requests requests-oauth -U
then run:
> python qbrequests.py