#Here is how I keep my secrets out of my source code when working with OpenShift
-
find your app's ssh address:
rhc app show YOUR_APP_NAME
-
ssh into your gear to set your environment variables:
ssh YOUR_APPS_SSH_URL
# Turn DD-WRT wireless radio on for business hours only. Verify wireless interface for your router model. | |
# Place in WebUI > Administration > Management > Cron | |
0 18 * * 1,2,3,4,5 root wl -i eth1 radio off | |
0 6 * * 1,2,3,4,5 root wl -i eth1 radio on |
#Here is how I keep my secrets out of my source code when working with OpenShift
find your app's ssh address:
rhc app show YOUR_APP_NAME
ssh into your gear to set your environment variables:
ssh YOUR_APPS_SSH_URL
ruby date_based_archive.rb ~/Maildir/.Archive
# include this in application controller | |
module Authentication | |
protected | |
# Inclusion hook to make #current_user and #signed_in? | |
# available as ActionView helper methods. | |
def self.included(base) | |
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method | |
end | |
# Returns true or false if the user is signed in. |
require 'bcrypt' | |
class User | |
include DataMapper::Resource | |
attr_accessor :password, :password_confirmation, :password_reset | |
timestamps :at | |
property :id, Serial |
# To just pull changes from Github, forcing Git to use your local changes for any conflicts: | |
git pull --strategy=ours origin master | |
# To completely update each of your Git repositories in one command (run this inside each repository): | |
git add . && git commit -m "Updating to current working version" && git pull --strategy=ours origin master && git push origin master |
register({ | |
name: 'moodle.domain.com', | |
url: 'http://moodle.domain.com/', | |
icon: 'http://moodle.domain.com/theme/mytheme/favicon.ico', | |
domains: [ 'moodle.domain.com' ], | |
sessionCookieNames: [ 'MoodleSession', 'MoodleSessionTest' ], | |
identifyUser: function() { | |
var site = this.httpGet('http://moodle.domain.com/user/view.php'); | |
this.userName = site.body.querySelector('div.logininfo a').text; |
require 'rubygems' | |
require 'haml' | |
require 'sinatra' | |
require 'sinatra/flash' | |
require 'file_uploader' | |
enable :sessions | |
get '/' do | |
haml :index |
module Sinatra | |
class Base | |
def call!(env) | |
@env = env | |
@request = Request.new(env) | |
@response = Response.new | |
@params = indifferent_params(@request.params) | |
force_encoding(@params) |
module Food | |
def self.included(model) | |
model.property :id, Serial | |
model.property :price, Integer, :min => 0 # builtin validation works just fine | |
model.property :calories, Integer, :min => 0 | |
model.before(:valid?, :custom_validation) | |
end | |
def custom_validation |