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
# app/controllers/users/password_controller.rb | |
class Users::PasswordsController < Devise::PasswordsController | |
def resource_params | |
params.require(:user).permit(:email, :password, :password_confirmation) | |
end | |
private :resource_params | |
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
#!/bin/sh | |
sudo rm /var/lib/mongodb/mongod.lock | |
sudo mongod --repair | |
sudo service mongodb start |
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
import os | |
path = os.getcwd() | |
for root, dirs, files in os.walk(path): | |
print("visiting: ", root) | |
os.chdir(root) | |
py_files = [file for file in files if file[-3:]=='.py'] | |
for py_file in py_files: | |
cmd = "python {0}".format(py_file) | |
print("running: ", cmd) |
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 | |
FILE=$(echo $1 | sed 's/.pdf//') | |
echo "$ pdfcrop $FILE.pdf --margins 12" | |
pdfcrop $FILE.pdf --margins 12 | |
echo "$ pdftops $FILE-crop.pdf" | |
pdftops $FILE-crop.pdf |
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
def prepare_sql params | |
ActiveRecord::Base.send 'sanitize_sql_array', params | |
end | |
ActiveRecord::Base.connection.execute(prepare_sql ["update users set total_visits = total_visits + ? where id = ?", visits_increment, user_id]) |
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 PeopleController < ApplicationController | |
def index | |
@people = Person.all | |
logger.info @people.inspect | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @people } | |
end | |
end |
NewerOlder