This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Migration files: | |
class CreateCategory < ActiveRecord::Migration | |
def self.up | |
create_table :categories do |t| | |
t.string :name | |
t.timestamps | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function pin(Array $params=array()) | |
{ | |
$pin=""; | |
$options = array(); | |
$ip = $_SERVER['REMOTE_ADDR']; | |
$q = "SELECT grv.ip_address,grs.printing_pin FROM guest_room_view grv INNER JOIN guest_room_settings grs on grv.room_id=grs.guest_room_id"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
production: | |
email_delivery: | |
delivery_method: :async_smtp | |
smtp_settings: | |
tls: true | |
enable_starttls_auto: true | |
address: "smtp.gmail.com" | |
port: '587' | |
domain: "smtp.gmail.com" | |
authentication: :plain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section: screens | |
msamson: | |
heroku-2: | |
end | |
section: links | |
msamson: | |
right(10,100) = heroku-2(10,100) | |
heroku-2: | |
left(10,100) = msamson(10,100) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://erikonrails.snowedin.net/?p=212 | |
desc "Imports a CSV file into an ActiveRecord table" | |
task :csv_model_import, :source, :model, :needs => :environment do |task,args| | |
def import_csv(classname, options = {}) | |
lines = File.new(options[:filename]).readlines | |
header = lines.shift.strip | |
keys = header.split(',') | |
model = Module.const_get(classname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example of a production database called "db_prod" connecting to a replica set | |
* running on two systems, "db1" and "db2" with the replica set name of "prod_01". | |
* | |
* This setup assumes that you're running a recent version of MongoDB as well as | |
* the PHP extension. | |
**/ | |
Connections::add('default', array( | |
'production' => array( | |
'type' => 'MongoDb', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TODO: compute recipe food values | |
namespace :recipe do | |
desc "Imports JSON recipes" | |
task :json_import, [:source, :basepath] => :environment do |task,args| | |
require 'rubygems' | |
require 'json' | |
def import_recipe(source, raw) | |
recipe = Recipe.new | |
recipe.name = raw['name'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf-8 | |
set nocompatible " be iMproved | |
filetype off " required! | |
set t_Co=256 | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
Bundle 'gmarik/vundle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MusicCleaner | |
class Cleaner | |
def initialize(dir, musicfiles = nil) | |
@types = musicfiles || ['.mp3', '.ogg', '.flac', '.m4a', '.aac'] | |
@delete = ['.ini', '.txt', '.nfo', '.db', '.m3u'] | |
@skip = ['.', '..'] | |
@dir = dir | |
end | |
def clean!(dir = nil) | |
dir = dir || @dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from flask import Blueprint, request | |
from .middlewares import (m, validate) | |
posts = Blueprint('posts', __name__, url_prefix='/posts') | |
def index(): | |
posts = dict() | |
return dict(posts=posts) |
OlderNewer