Skip to content

Instantly share code, notes, and snippets.

@wayne-o
wayne-o / m1.cs
Created September 18, 2015 07:08
Multuplier - long winded
using System;
using System.Collections.Generic;
public static class Extensions{
public static IEnumerable<int> To(this int from, int to)
{
for (int i = from; i <= to; i++)
{
yield return i;
}
sonatribe=> \dt public.*
List of relations
Schema | Name | Type | Owner
--------+----------------------------------------+-------+--------
public | artist | table | stuser
public | artist_tags__tag_artists | table | stuser
public | attempt | table | stuser
public | auth | table | stuser
public | discoursesso | table | stuser
public | eventInstance | table | stuser
@wayne-o
wayne-o / gist:b211790056937da94b6a
Created April 18, 2015 10:06
Without property names
/**
* ListingEvent.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
tableName: 'listingEvent',
@wayne-o
wayne-o / gist:653183531bc78a1a0ec9
Created April 18, 2015 10:06
With column names
/**
* ListingEvent.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
tableName: 'listingEvent',
/**
* FilteredLineupController
*
* @description :: Server-side logic for managing Filteredlineups
* @help :: See http://links.sailsjs.org/docs/controllers
*/
var winston = require('winston');
module.exports = {
//ListingEvent.js
module.exports = {
tableName: 'listingEvent',
attributes: {
name: { type: 'string' },
start: { type: 'date' },
end: { type: 'date' },
eventInstanceSlug: { type: 'string' },
location: {
var request = require("request");
var Waterline = require('waterline');
var cloudinary = require('cloudinary');
cloudinary.config({
cloud_name: '****',
api_key: '****',
api_secret: '****'
});
using System;
using FluentNHibernate.Mapping;
using System.Collections.Generic;
using NHibernate;
using FluentNHibernate.Cfg;
using FluentNHibernate.Automapping;
using FluentNHibernate.Data;
using FluentNHibernate.Cfg.Db;
using NHibernate.Tool.hbm2ddl;
public MemoryStream ZipStream(MemoryStream input){
UIImage img = input.ToUIImage ();
img = img.Scale (new System.Drawing.SizeF (((img.Size.Width / 100) * 40), ((img.Size.Height / 100) * 40)), 0);
var compressed = img.AsJPEG(0.7f);
var minput = compressed.AsStream ();
MemoryStream zip = new MemoryStream ();
GZipStream zipper = new GZipStream (zip, CompressionMode.Compress);
minput.CopyTo(zipper);
public object Get(LineupRequest request)
{
var response = new LineupResponse ();
var sw = new Stopwatch ();
sw.Start ();
using(var db = con.Open ()){
var eventInstance = db.LoadSelect <Model.EventInstance>(q => q.Slug == request.Slug).FirstOrDefault ();
var locationIds = eventInstance.Locations.Select (x => x.Id);