Skip to content

Instantly share code, notes, and snippets.

View swr's full-sized avatar

Sean W. Richardson swr

View GitHub Profile
sudo find ./ -type d -exec chmod 2775 {} \;
@swr
swr / mysql db user creation
Created September 24, 2009 23:53
mysql db commands
mysql -u root -p
CREATE DATABASE databasename;
GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
EXIT
subject="[{app}] New production deployment..." \
body="{{user}} deployed {{app}}
{{url}}
Git head:
{{head_long}}
Git Log:
{{git_log}}
User.all.each { |p| User.update_counters p.id, :recipes_count => -p.recipes_count, :comments_count => -p.comments_count }
User.all.each { |p| User.update_counters p.id, :recipes_count => p.recipes.length, :comments_count => p.comments.length }
Recipe.all.each { |p| Recipe.update_counters p.id, :ratings_count => -p.ratings_count, :comments_count => -p.comments_count }
Recipe.all.each { |p| Recipe.update_counters p.id, :ratings_count => p.ratings_count.length, :comments_count => p.comments.length }
class HomeController < ApplicationController
def index
# render the landing page
redirect_to root_url
end
def show
if params[:page].nil? || params[:page] == :home
render :action => :home
else
@swr
swr / gist:2938950
Created June 15, 2012 22:10
Turn off Pixelmator converting files to its native format when opened and its auto save annoyances
turn off auto conversion
defaults write com.pixelmatorteam.pixelmator alwaysUseNativeFormat -bool no
turn off auto save
defaults write com.pixelmatorteam.pixelmator disableAutosave -bool yes
@swr
swr / gist:110448fdd2a2049a8e13
Created June 15, 2014 23:59
Re-enable the ability to resignFirstResponder in a modal view
// In the view controller controlling the modal:
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
// Then you can
[self.state resignFirstResponder];
@swr
swr / later-data.js
Created October 13, 2015 21:30
add delay to ember data return via RSVP.later
var self = this;
return new Ember.RSVP.Promise((resolve)=> {
Ember.run.later(()=> {
resolve(self.store.findAll('user'));
}, 3000);
});

Keybase proof

I hereby claim:

  • I am swr on github.
  • I am swr (https://keybase.io/swr) on keybase.
  • I have a public key ASAvuzuwdXpl5aKf2xazuhQ1uwVo3KOfHtu-yKynTZZw2go

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am swr on github.
  • I am swr (https://keybase.io/swr) on keybase.
  • I have a public key ASC5oHutZGJ2xBe-GSjFrcTigQlUJMdbLa9ESMIIiewaWwo

To claim this, I am signing this object: