Skip to content

Instantly share code, notes, and snippets.

View cyberoctopi's full-sized avatar
😣
Tinkering

No Say cyberoctopi

😣
Tinkering
  • No where
View GitHub Profile
@cyberoctopi
cyberoctopi / build.sbt
Created March 30, 2012 18:28
Lift sbt build file
name := "project"
version := "1.0"
scalaVersion := "2.9.1"
seq(webSettings: _*)
// If using JRebel
scanDirectories := Nil
@cyberoctopi
cyberoctopi / ChatRoom.scala
Created April 2, 2012 06:24
play framework chat
package models
import akka.actor._
import akka.util.duration._
import play.api._
import play.api.libs.json._
import play.api.libs.iteratee._
import play.api.libs.concurrent._
@cyberoctopi
cyberoctopi / graph.py
Created April 2, 2012 23:07
python basic graph
class Graph(dict)
def __init__(self, v=[], es=[])
"""create a ew graph. (vs) is a list of vertices, (es) is a list of of edges"""
for v in vs:
self.add_vertex(v)
for e in es:
self.add_edge(e)
def add_vertex(self, v):
package com.gumtrail;
import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.app.Fragment;
belongs_to :user
has_many :categorizations
has_many :categories, :through => :categorizations
# accepts_nested_attributes_for :categories,
# :reject_if => lambda { |a| a[:content].blank? },
# :allow_destroy => true
class Categorization < ActiveRecord::Base
attr_accessor :category_name
belongs_to :product
belongs_to :category
def category_name
category.try(:name)
end
@cyberoctopi
cyberoctopi / infb.py
Created April 18, 2012 05:10 — forked from ruel/infb.py
A script to scrape information from your facebook friends.
#!/usr/bin/python
'''
InFB - Information Facebook
Usage: infb.py user@domain.tld password
http://ruel.me
Copyright (c) 2011, Ruel Pagayon
All rights reserved.
@cyberoctopi
cyberoctopi / gist:2469328
Created April 23, 2012 07:24 — forked from pithyless/gist:1208841
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

web: python app.py runserver
package com.example
import unfiltered.request._
import unfiltered.response._
import unfiltered.netty._
/** Asynchronous plan that gets the time in a ridiculous fashion.
* (But imagine that it's using a vital external HTTP service to
* inform its response--this is a fine way to do that.) */