Skip to content

Instantly share code, notes, and snippets.

View ptescher's full-sized avatar
🏠
Working from home

Patrick Tescher ptescher

🏠
Working from home
View GitHub Profile
def get_user_image(user)
image_html = ""
unless user.nil?
if user.avatar?
image_html += image_tag(user.avatar.thumbnail, {:height=>'50px',:width=>'50px'})
elsif user.fb_user_id
image_html += '<fb:profile-pic linked="false" uid="' + user.fb_user_id.to_s + '" size="square" ></fb:profile-pic>'
else
image_html += gravatar_for(user)#"/images/default_user.png" height="50px"
end
MONGODB willcall_staging['$cmd'].find({:getnonce=>1}).limit(-1)
MONGODB willcall_staging['$cmd'].find({"authenticate"=>1, "user"=>"willcall", "nonce"=>"7044e9d1d874f71e", "key"=>"8c7c489dc9fbff7da1b918de646efb08"}).limit(-1)
MONGODB [INFO] Refreshing...
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ping=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ping=>1}).limit(-1)
MONGODB admin['$cmd'].find({:ping=>1}).limit(-1)
@ptescher
ptescher / frank_rails.rb
Created March 14, 2012 01:05
Frank Rails Integration
current_directory = Dir.pwd
ENV["RAILS_ENV"] ||= 'test'
RAILS_ROOT = ENV["RAILS_ROOT"] || File.expand_path("#{File.dirname(File.expand_path(__FILE__))}/../../../../Rails")
ENV["RAILS_ROOT"] = RAILS_ROOT
Dir.chdir(RAILS_ROOT)
$LOAD_PATH.unshift File.expand_path("#{RAILS_ROOT}/config")
require "environment"
Dir.chdir(current_directory)
@ptescher
ptescher / hack.sh
Created March 31, 2012 22:40 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ptescher
ptescher / gist:3708894
Created September 12, 2012 18:31
Reconnect All Messages Accounts
using terms from application "Messages"
on login finished for theService
set allServices to get services
repeat with aService in allServices
set serviceName to name of aService
log in service serviceName
end repeat
end login finished
end using terms from
@ptescher
ptescher / monitor_resque.rb
Created February 27, 2013 01:02
Monitor Resque via CloudWatch
require 'resque'
resque_info = Resque.info
valid_fields = ["pending", "processed", "queues", "workers", "working", "failed"]
aws_access_key_string = ENV['AWS_ACCESS_KEY_ID'] ? "--access-key #{ENV['AWS_ACCESS_KEY_ID']}" : ""
secret_key_string = ENV['AWS_SECRET_KEY'] ? "--secret-key #{ENV['AWS_SECRET_KEY']}" : ""
region_string = ENV['AWS_REGION'] ? "--region #{ENV['AWS_REGION']}" : ""
@ptescher
ptescher / deploy.sh
Last active August 29, 2015 14:05
Play Binary Deploy Script
#!/bin/bash -e
#####
# Run this before the first deploy:
# rhc env set PLAY_APP_NAME=messageboard-backend
# rhc configure-app [APP NAME] --deployment-type binary
#####
echo "Compiling"

Keybase proof

I hereby claim:

  • I am pat2man on github.
  • I am ptescher (https://keybase.io/ptescher) on keybase.
  • I have a public key whose fingerprint is 97AC A492 EB89 F666 CB9D CE74 2BA7 C6A8 926C 4351

To claim this, I am signing this object:

@ptescher
ptescher / deploy_diva.sh
Created February 26, 2015 20:58
Diva Deploy Script
#!/bin/bash -e
##############
##
## First you need to create an app:
## rhc app create diva http://cartreflect-claytondev.rhcloud.com/reflect\?github\=47deg/openshift-cartridge-scala --no-git -s
## Then enable binary deploys:
## rhc configure-app diva --deployment-type binary
##
@ptescher
ptescher / deploy_inv.sh
Last active August 29, 2015 14:16
INV Deploy Script
#!/bin/bash -e
##############
##
## First you need to create an app:
## rhc app create inventory jbossews-2.0 mysql-5.5 --no-git -s
## Then enable binary deploys:
## rhc configure-app inventory --deployment-type binary
##