Skip to content

Instantly share code, notes, and snippets.

View victorbstan's full-sized avatar

Victor Stan victorbstan

  • Toronto & Remote
View GitHub Profile
(ns com.freiheit.clojure.appengine.appengine-local
(:use
[compojure.http routes servlet helpers]
clojure.contrib.test-is
compojure.server.jetty
[clojure.contrib def str-utils duck-streams])
(:require
[clojure.contrib.logging :as log])
(:import
[com.google.appengine.api.labs.taskqueue.dev LocalTaskQueue]
function normalizeData2(data, intoArray) {
for(var key in data) {
var value = data[key];
if (typeof(value) === 'object') {
normalizeData2(value, intoArray);
} else {
pair = [key, value];
intoArray.push(pair);
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css" />
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAUXDSXET8IRGdgHP9FpGw5BT-fVzUWGS_eJ2ZLPBO_6yPqTi0vhQKAzahOrduDq0xQk09GR-UP3Jgcg'></script>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.google.com/jsapi?key=ABQIAAAAUXDSXET8IRGdgHP9FpGw5BT-fVzUWGS_eJ2ZLPBO_6yPqTi0vhQKAzahOrduDq0xQk09GR-UP3Jgcg"></script>
<script type="text/javascript">
google.load("jquery", '1.4');
google.load("maps", "2.x");
</script>
$(function() {
//run the accordion plugin, set height of sections to height of content
$("#accordion").accordion({ autoHeight: false });
});
;(function($) {
//write new sammy application
var app = new Sammy.Application(function() {
with(this) {
//corresponds to routes such as #/section/1
get('#/section/:section_id', function() { with(this) {
//get first part of current url, without hash
var base_path = window.location.href.split("#")[0];
var real_id = 0;
var current_page;
;(function($) {
//create new sammy app
var app = new Sammy.Application(function() {
with(this) {
//corresponds to routes like #/slide/1
get('#/slide/:page_id', function() { with(this) {
!default_rounded_amount ||= 5px
// Round corner at position by amount.
// values for position: "top-left", "top-right", "bottom-left", "bottom-right"
=round-corner(!position, !amount = !default_rounded_amount)
border-#{!position}-radius= !amount
-moz-border-#{!position}-radius= !amount
-webkit-border-#{!position}-radius= !amount
// Round left corners by amount
@victorbstan
victorbstan / gist:1256414
Created October 1, 2011 17:57 — forked from Amitesh/gist:1160428
Paperclip file name cleanup or rename
#http://blog.wyeworks.com/2009/7/13/paperclip-file-rename
Paperclip.interpolates :default_image_type do |attachment, style|
attachment.instance.get_user_default_profile_image
end
Paperclip.interpolates :normalized_avatar_file_name do |attachment, style|
attachment.instance.normalized_avatar_file_name
end
@victorbstan
victorbstan / your_application.rb
Created October 28, 2011 12:31 — forked from nicholasjhenry/your_application.rb
PayRoll application, embedded in Rails, borrowing from Use Case Driven Architecture and DCI
## PayRoll Application Gem
# lib/pay_roll/pay_day_service.rb
# Consider this Use Case as the Context in DCI
#
class PayRoll::PayDayService
def initialize(date=Date.today)
@date = date
# Employee could be any data source from the host,
@victorbstan
victorbstan / video_pyopencv.py
Created March 20, 2012 02:07 — forked from kriben/video_pyopencv.py
Python opencv feed from webcam
import opencv
#this is important for capturing/displaying images
from opencv import highgui
import pygame
import sys
camera = highgui.cvCreateCameraCapture(0)
def get_image():
im = highgui.cvQueryFrame(camera)
# Add the line below if you need it (Ubuntu 8.04+)
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="author" content="Victor Stan">
<meta name="description" content="Get multiple video streams on one page. Adapted from code by Muaz Khan">
<title>Video Camera</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" ></script>