Skip to content

Instantly share code, notes, and snippets.

View victorbstan's full-sized avatar

Victor Stan victorbstan

  • Toronto & Remote
View GitHub Profile
@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 / php_object_to_array.php
Created December 17, 2010 04:18
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@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_rouded_corner_mixins.sass
Created March 27, 2011 18:48
SASS cross browser rounded corner mixins
$default_rounded_amount: 5px
// Round corner at position by amount.
@mixin round-corner($position, $amount: $default_rounded_amount)
border-#{$position}-radius: $amount
-webkit-border-#{$position}-radius: $amount
@mixin round-corner-mozilla($position, $amount: $default_rounded_amount)
-moz-border-radius-#{$position}: $amount
// Round left corners by amount
@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