Skip to content

Instantly share code, notes, and snippets.

@sdepold
sdepold / Readme.md
Created September 12, 2011 05:44 — forked from grosser/Readme.md
Most recommended games on Steam

Get the most recommended games from steam (because steam does not tell...) this is an example and no invitation to DDos steam ;)

@sdepold
sdepold / gist:3040391
Created July 3, 2012 15:17
associations in sequelize
var Sequelize = require('sequelize')
, sequelize = new Sequelize('sequelize_test', 'root', null, {
logging: false
})
var Project = sequelize.define('project', {
name: Sequelize.STRING
})
var Task = sequelize.define('task', {
@sdepold
sdepold / LICENSE.txt
Created August 15, 2012 05:50 — forked from 140bytes/LICENSE.txt
140byt.es -- addObserverMethods
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Sascha Depold http://depold.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sdepold
sdepold / gist:1757695
Created February 7, 2012 06:34
hasMany + belongsTo in sequelize
var Sequelize = require("sequelize")
var sequelize = new Sequelize('database', 'root')
var User = sequelize.define('User', { username: Sequelize.STRING })
var Comment = sequelize.define('Comment', { text: Sequelize.TEXT })
User.hasMany(Comment)
Comment.belongsTo(User)
sequelize.sync({force: true}).success(function() {
@sdepold
sdepold / app.js
Created March 21, 2012 16:31
a very basic shop system with sequelize
const Sequelize = require("sequelize")
////////////////////
// database setup //
////////////////////
var sequelize = new Sequelize('master-thesis', 'root', null, {
logging: false
})
@sdepold
sdepold / virtual-attributes.js
Created October 29, 2013 18:24
virtual attributes with sequelize
var Sequelize = require('sequelize')
, sequelize = new Sequelize('sequelize_test', 'root')
var User = sequelize.define('User', {
username: Sequelize.STRING,
password_hash: Sequelize.STRING
}, {
validate: {
password: function(next) {
if (((this._password || "").trim() !== '') && (this._password === this._password_confirmation)) {
var Sequelize = require('sequelize')
, sequelize = new Sequelize('sequelize_test', 'root')
var Manufacturer = sequelize.define('manufacturer', {
name: Sequelize.STRING
});
var GraphicsCard = sequelize.define("graphics_card", {
model: Sequelize.STRING,
RAM: Sequelize.INTEGER
fn get_path_to(target: & str, opt: Option<&str>) -> Path {
let path: ~str = match target {
"root" => {
os::homedir().unwrap().to_str() + "/.rsvm"
}
"version" => {
get_path_to(~"root", None).to_str() + ~"/v" + opt.unwrap()
}
fn get_rsvm_directory() -> ~str {
os::homedir().get_ref().to_str() + "/.rsvm"
}
@sdepold
sdepold / travis.sh
Last active October 29, 2015 20:00
io.js on travis
if [ ! -z "$IOJS" ] && [ "$IOJS" != "false" ]; then
echo "Installing io.js v$IOJS ..."
curl -s https://iojs.org/dist/v$IOJS/iojs-v$IOJS-linux-x64.tar.xz > iojs-v$IOJS-linux-x64.tar.xz
tar xf iojs-v$IOJS-linux-x64.tar.xz
export PATH="$(pwd)/iojs-v$IOJS-linux-x64/bin/:$PATH"
echo "Installation successful"
else
echo "Using node..."
fi