Skip to content

Instantly share code, notes, and snippets.

@ynonp
ynonp / picker.html
Created January 28, 2013 06:32
Color PIcker Demo
<!DOCTYPE html>
<html>
<head>
<title>Canvas Color Picker</title>
<meta name="viewport" content="width=device-width"/>
<style>
canvas {
outline: 2px solid blue;
display: block;
@ynonp
ynonp / wall.html
Created January 28, 2013 09:09
wall.html
<!DOCTYPE html>
<html>
<head>
<title>Mobile Wall</title>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
@ynonp
ynonp / create.js
Created January 28, 2013 17:36
mongoose relationships
var mongoose = require('mongoose');
mongoose.connect('localhost/test');
var Schema = mongoose.Schema;
var AlbumSchema = new Schema({
artist: { type: Schema.Types.ObjectId, ref: 'Artist' },
name: String,
year: Number,
// lastMod.js
module.exports = exports = function lastModifiedPlugin (schema, options) {
schema.add({ lastMod: Date })
schema.pre('save', function (next) {
this.lastMod = new Date
next()
})
if (options && options.index) {
/**
* Created with JetBrains WebStorm.
* User: ynonperek
* Date: 1/28/13
* Time: 9:14 PM
*
* Mongoose plugin that adds a hashed password field
*/
var bcrypt = require('bcrypt');
@ynonp
ynonp / dabblet.css
Created February 4, 2013 08:01
Untitled
body {
font-size: 16px;
}
div {
font-size: 1.5em;
}
h1 {
font-size: 2em;
<!DOCTYPE html>
<html>
<head>
<title>Image Gallery</title>
<style>
#gallery {
list-style: none;
}
#gallery img {
width: 200px;
.autocomplete {
list-style: none;
position: absolute;
top: 0;
left: 0;
padding: 0;
margin: 0;
outline: 1px solid gray;
display: none;
}
@ynonp
ynonp / dabblet.css
Created February 27, 2013 09:10
Untitled
#nav {
list-style: none;
padding: 0; margin: 0;
display: none;
}
li {
display: inline-block;
padding: 10px;
background: #777;
use strict;
use warnings;
use v5.14;
use List::Util qw/sum/;
use Data::Dumper;
sub diff_sum {
my ( $l_ref, $g_ref ) = @_;
return sum(@$l_ref) - sum(@$g_ref);
}