Skip to content

Instantly share code, notes, and snippets.

View DeaconDesperado's full-sized avatar

Mark Grey DeaconDesperado

  • Spotify
  • NY, New York
View GitHub Profile
@DeaconDesperado
DeaconDesperado / blogblog.php
Created September 8, 2011 19:37
ORM validation
<?
class Model_Blog_Blog extends ORM{
protected $_table_name = 'blogs';
protected $_has_many = array('images'=>array('model'=>'blog_image','foreign_key'=>'blog_id'));
public function rules()
@DeaconDesperado
DeaconDesperado / DBHandler.py
Created July 19, 2012 15:14
A quick MySQLdb intro for jason
__author__="mark"
__date__ ="$Jan 12, 2012 5:02:38 PM$"
import MySQLdb as mysql
from MySQLdb import connections
from MySQLdb import cursors
class DBHandler(mysql.connections.Connection):
def __init__(self,dhost=db_host,duser=db_user,dpass=db_pass,dbname=db,cursor='DictCursor'):
super(DBHandler,self).__init__(
@DeaconDesperado
DeaconDesperado / gist:5396884
Last active December 16, 2015 07:09
A modulus-based 2D coordinate normalizer.
coords = (
(41.2863,-73.78689),
(41.2864,-73.78690),
(41.2869,-73.78698),
)
from math import floor
def gen_hash(coords):
pro_lat = floor(coords[0]*1000.0)
public class UserDAO(){
static cache;
static user_model;
public static getInstance(CacheInterface cache, UserInterface user_model){
this.cache = cache;
this.user_model = user_model;
}
public static get(int Id){
@DeaconDesperado
DeaconDesperado / greets.scala
Last active December 17, 2015 07:58
An example of for-yield flatmapping in scala.
val inputList = List("hi","hello","Bye");
val salutations = List("guvnor","sir","madame","dude","buddy")
def isFormal(ele:String )= ele match{
case "guvnor"=>true
case "sir"=>true
case "madame"=>true
case _=>false
}
@DeaconDesperado
DeaconDesperado / gist:5750729
Created June 10, 2013 17:39
Macvim Homebrew install error
==> Downloading https://github.com/b4winckler/macvim/archive/snapshot-66.tar.gz
Already downloaded: /Library/Caches/Homebrew/macvim-7.3-66.tar.gz
tar xf /Library/Caches/Homebrew/macvim-7.3-66.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-tlib=ncurses --with-compiledby=Homebrew --with-local-dir=/usr/local --enable-cscope --enable-pythoninterp=yes
./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-tlib=ncurses --with-compiledby=Homebrew --with-local-dir=/usr/local --enable-cscope --enable-pythoninterp=yes
checking whether make sets $(MAKE)... yes
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler defaul

Love your app, esp UI, but the service end is a disaster for me right now.

  1. When adding a user to my list, I receive an error message. JS Console warns about Cross-Domain origin policy:
XMLHttpRequest cannot load https://api.wunderlist.com/batch. Origin https://www.wunderlist.com/ is not allowed by Access-Control-Allow-Origin. 
  1. When attempting to login, HTTP req for api subdomain returns 502 Bad Gateway.
@DeaconDesperado
DeaconDesperado / ll.py
Created July 10, 2013 15:46
Linked list ithsmallest from value
class Node:
def __init__(self,val):
self.val = val
self.next = None
class LL:
def __init__(self):
self.first = None
self._n = 0
@DeaconDesperado
DeaconDesperado / gist:5986942
Created July 12, 2013 19:11
scrimage maven output
[INFO] ------------------------------------------------------------------------
[INFO] Building scrimage-core 1.3.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ scrimage-core ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ scrimage-core ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
WARNING: -p has been deprecated and will be reused for a different (but still very cool) purpose in ScalaTest 2.0. Please change all uses of -p to -R.
Run starting. Expected test count is: 89
DiscoverySuite:
GifWriterTest:
- GIF output happy path *** FAILED ***
com.sksamuel.scrimage.Image@584a5c78 did not equal com.sksamuel.scrimage.Image@79fcf790 (GifWriterTest.scala:19)
- GIF progressive output happy path *** FAILED ***
com.sksamuel.scrimage.Image@31d8d237 did not equal com.sksamuel.scrimage.Image@11d13272 (GifWriterTest.scala:30)
MutableImageTest:
- when flipping on x axis a new image is not created