Skip to content

Instantly share code, notes, and snippets.

View uhhuhyeah's full-sized avatar

David A McClain uhhuhyeah

View GitHub Profile
MBPro:loc_dashboard davidamcclain$ rake ts:in
(in /Users/davidamcclain/apps/notch8/loc_dashboard)
Generating Configuration to /Users/davidamcclain/apps/notch8/loc_dashboard/config/development.sphinx.conf
Sphinx 0.9.8-release (r1371)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/Users/davidamcclain/apps/notch8/loc_dashboard/config/development.sphinx.conf'...
indexing index 'post_core'...
ERROR: source 'post_core_0': unknown type 'pgsql'; skipping.
ERROR: index 'post_core': no valid sources configured; skipping.
// From http://www.gayadesign.com/diy/snotify-easy-notifications-in-jquery/
var sNotify = {
timeOpen: 10, //change this number to the amount of second you want the message opened
queue: new Array(),
closeQueue: new Array(),
addToQueue: function(msg) {
// Example of using a custom image as a view ?
customView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
customView.image = [UIImage imageNamed:@"Foo.png"];
[window addSubview: customView];
[window bringSubviewToFront: customView];
// Process
@uhhuhyeah
uhhuhyeah / detect_ipad_on_earlier_os.h
Created July 1, 2010 23:16
How to detect is ipad on earlier pre ipad OS versions.
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;
}
#endif
NSString *tz = [[NSTimeZone localTimeZone] name];
// Or ...
NSString *tz = [[NSTimeZone localTimeZone] localizedName:NSTimeZoneNameStyleShortDaylightSaving locale:[NSLocale currentLocale]]; // Returns @"PST" etc
# lives in config/initializers/
def recursive_symbolize_keys!(hash)
hash.symbolize_keys!
hash.values.select{|v| v.is_a? Hash}.each{|h| recursive_symbolize_keys!(h)}
end
AppSettings = YAML.load_file("#{Rails.root}/config/settings.yml")[Rails.env]
recursive_symbolize_keys!(AppSettings)
class User < ActiveRecord::Base
def to_xml(options={})
options[:only] = [:id, :name, :other_attr]
super(options)
end
end
- (NSString *)ordinalize:(NSInteger)number{
if (number >= 11 && number <= 13)
return [NSString stringWithFormat:@"%dth",number];
switch (number % 10) {
case 1:
return [NSString stringWithFormat:@"%dst",number];
case 2:
return [NSString stringWithFormat:@"%dnd",number];
case 3:
return [NSString stringWithFormat:@"%drd",number];
ps -ef | grep " process or pid " | grep -v grep
@uhhuhyeah
uhhuhyeah / loc_searchd_kick.sh
Created November 19, 2010 23:55
Useful in giving search on LOC a kick
/usr/bin/indexer --config /data/loc/current/config/production.sphinx.conf --rotate --all