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
#http://blog.wyeworks.com/2009/7/13/paperclip-file-rename | |
Paperclip.interpolates :default_image_type do |attachment, style| | |
attachment.instance.get_user_default_profile_image | |
end | |
Paperclip.interpolates :normalized_avatar_file_name do |attachment, style| | |
attachment.instance.normalized_avatar_file_name | |
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
Create recent application dock item in Mac | |
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && killall Dock | |
https://discussions.apple.com/thread/3217726?tstart=0 | |
Use smart folder option to create recent filter in sidebar. |
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
[ | |
{ "keys": ["alt+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["alt+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"} }, | |
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" } | |
] |
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
sudo vi /etc/udev/rules.d/99-android.rules | |
http://developer.android.com/tools/device.html | |
http://www.reactivated.net/writing_udev_rules.html | |
http://eagle.phys.utk.edu/guidry/android/installOnDevice.html |
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
Query pg_stat_activity and get the pid values you want to kill and issue select pg_terminate_backend(pid int) to them. | |
PostgreSQL 9.1 and below: | |
SELECT pg_terminate_backend(pg_stat_activity.procpid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'mydb_prod_jan'; | |
PostgreSQL 9.2 and above: |
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
#apache-cron-watcher.sh | |
#!/bin/sh | |
run=`ps ax | grep /usr/sbin/apache2 | grep -v grep | cut -c1-5 | paste -s -` | |
if [ "$run" ]; | |
then | |
echo “Apache is running” | |
else | |
echo "Apache not running" | |
/etc/init.d/apache2 restart |
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
desc "convert a latin1 database with utf8 data into proper utf8" | |
task :convert_to_utf8 => :environment do | |
puts Time.now | |
dryrun = ENV['DOIT'] != '1' | |
conn = ActiveRecord::Base.connection | |
if dryrun | |
def conn.run_sql(sql) | |
puts(sql) | |
end | |
else |
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
SELECT default_character_set_name FROM information_schema.SCHEMATA S | |
WHERE schema_name = "database_name"; | |
show FULL columns from table_name; | |
For Schemas: | |
SELECT default_character_set_name FROM information_schema.SCHEMATA S | |
WHERE schema_name = "schemaname"; | |
For Tables: |
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
Device wise apps : | |
<pre> | |
<%= JSON.pretty_generate(JSON.parse(@info.to_json)) %> | |
</pre> |
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
// Place all the behaviors and hooks related to the matching controller here. | |
// All this logic will automatically be available in application.js. | |
/** | |
* Module for SampleWebApp Application | |
* @author : Amitesh Kumar | |
* | |
*/ | |
( function( $ ){ | |