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
class Folder | |
include DataMapper::Resource | |
has n, :subfolders, 'Folder' | |
has n, :messages | |
belongs_to :parent, :model => 'Folder', :required => false | |
belongs_to :owner, :model => 'User', :key => true | |
property :id, String, :key => true | |
property :name, String |
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
require 'fedora' | |
Fedora.map.each do |route, app| | |
map(route) { run app } | |
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
require 'bcrypt' | |
class User | |
include DataMapper::Resource | |
attr_accessor :password, :password_confirmation | |
timestamps :at | |
property :id, Serial |
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
#!/bin/bash | |
# Source: https://bbs.archlinux.org/viewtopic.php?pid=853603#p853603 | |
# Author: falconindy | |
DIFF=${DIFF:-diff} | |
if [[ ! -f PKGBUILD ]]; then | |
echo "error: No PKGBUILD found in working directory." | |
exit 1 | |
fi >&2 |
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
class User | |
def self.authenticate(email, password) | |
user = find_by_email(email) | |
if user && BCrypt::Password.new(user.password_hash) == password | |
user | |
else | |
nil | |
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
# Copyright (c) 2010,2011 Jonathan Stott | |
# | |
# Permission is hereby granted, free of charge, to any person ob- | |
# taining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without restric- | |
# tion, including without limitation the rights to use, copy, modi- | |
# fy, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is fur- | |
# nished to do so, subject to the following conditions: | |
# |
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
#!/usr/bin/ruby | |
# Copyright (c) 2010,2011 Jonathan Stott | |
# | |
# Permission is hereby granted, free of charge, to any person ob- | |
# taining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without restric- | |
# tion, including without limitation the rights to use, copy, modi- | |
# fy, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is fur- | |
# nished to do so, subject to the following conditions: |
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
# Sample configuration file for Unicorn (not Rack) | |
worker_processes 1 | |
# listen on the sinatra port | |
listen 4567 | |
# feel free to point this anywhere accessible on the filesystem | |
pid "#{ENV['XDG_CACHE_HOME']}/unicorn.pid" | |
stdout_path "#{ENV['XDG_CACHE_HOME']}/unicorn.log" |
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
#!/usr/bin/ruby | |
# Copyright (c) 2010 Jonathan Stott, unless otherwise noted | |
# | |
# Permission is hereby granted, free of charge, to any person ob- | |
# taining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without restric- | |
# tion, including without limitation the rights to use, copy, modi- | |
# fy, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is fur- | |
# nished to do so, subject to the following conditions: |
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
#!/usr/bin/ruby | |
# Jonathan D. Stott <jonathan.stott@gmail.com> | |
require 'fileutils' | |
require 'octopi' | |
include Octopi | |
def sh(command) | |
system command || abort(command) | |
end |