Skip to content

Instantly share code, notes, and snippets.

View victorbstan's full-sized avatar

Victor Stan victorbstan

  • Toronto & Remote
View GitHub Profile
//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) {
@victorbstan
victorbstan / post-it_css3_effects.html
Created December 12, 2010 17:02
Post it note curling off the page, a more realistic adaptation
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>post-it-realistic-drop-shaddow</title>
<meta name="preview" content="http://victorstan.com/css-effects/post-it-realistic-drop-shadow.html">
<style type="text/css" media="screen">
body {
background-color:#ddd;
}
#box {
@victorbstan
victorbstan / create_unique_sequential_index_mongo_db.js
Created December 16, 2010 04:07
A couple of short commands to add unique constraints on sequential index fields in a mongoDB document
// Mongo shell
// Let's say you need to have a sequential id; here, it is '_i'
// the other entry is a reference to another 'post' containing its natural MongoDB ObjectId
db.your_collection_name.insert({"_i":new NumberLong(1), "post_id":"4cf68ff393eae6291e00003a"});
// let's make sure we add an index that is defined as unique
db.your_collection_name.ensureIndex({"_i":1}, {unique:true});
// TODO: still need to provide the methodology used to auto-increment the unique field '_i'
@victorbstan
victorbstan / rails3_scaffold_generator_acceptable_value_types.txt
Created January 19, 2011 22:54
Comprehensive list of acceptable values the Rails 3 generator rakes when defining ActiveRecord value types.
#################################
Scaffold generator options:
Format: [name, type]
#################################
# Active Record supports the following types:
:primary_key
:string
:text
!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 / phone-regex.rb
Created February 18, 2011 05:10
a flexible regex for detecting north american 10 digi phone numbers with or without brackets around the prefix
/\A\(?[-. ]?\d{3}[-. ]?\)?[-. ]?\d{3}[-. ]?\d{4}\Z/
@victorbstan
victorbstan / sass-minimal-reset.sass
Created June 5, 2011 19:19
Sass minimal reset style
// minimal reset with html5
// provided by: http://snipt.net/catcubed/minimal-html5-css-reset-for-sass/
*
vertical-align: baseline
font-family: inherit
font-style: inherit
font-size: 100%
border: none
padding: 0
@victorbstan
victorbstan / neat_notification_system.js
Created June 5, 2011 21:32
JavaScript for NeatNotificationSystemTM for your web apps
// Requires jQuery
// FLASH NOTICE ANIMATION
$("#flash_notice").delay(5000).fadeOut("slow");
$("#flash_alert").delay(5000).fadeOut("slow");
$("#flash_error").delay(5000).fadeOut("slow");
@victorbstan
victorbstan / neat_notification_style.sass
Created June 5, 2011 21:36
Neat Notification SASS style
#flash_notice, #flash_alert, #flash_error
z-index: 999
@include round-corners(10px)
@include glow-disk(rgba(0,0,0,0.5))
position: absolute
right: 20px
height: 40px
line-height: 40px
background: rgba(0,0,0,0.8)
color: white
@victorbstan
victorbstan / neat_notification_style.css
Created June 5, 2011 21:37
Neat Notification CSS style
#flash_notice, #flash_alert, #flash_error {
z-index: 999;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
position: absolute;
right: 20px;