Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# rails console | |
ActiveRecord::Base.connection.tables.each do |table| | |
indexes = ActiveRecord::Base.connection.indexes(table) | |
if indexes.length > 0 | |
puts "====> #{table} <====" | |
indexes.each do |index| | |
puts "----> #{index.name}" | |
end | |
puts "====> #{table} <====" |
#### evals the schema into the current process | |
class SqliteTestDbLoader | |
# assumes your schema is generated for MySQL | |
# tweak for Postgres! | |
MYSQL_REPLACEMENTS = { | |
/ENGINE=InnoDB DEFAULT CHARSET=[a-z0-9]*/ => '', | |
/, collation: "[^"]*"/ => '' | |
} |
# config/initializers/active_admin.rb | |
# ...rest of the initializer here... | |
module AdminPageLayoutOverride | |
def build(*args) | |
# you can move the call to super at the end, if you wish | |
# to insert things at the begining of the page | |
super |
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict | |
This file remaps the key bindings of a single user on Mac OS X 10.5 to more | |
closely match default behavior on Windows systems. This makes the Command key | |
behave like Windows Control key. To use Control instead of Command, either swap | |
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys... | |
or replace @ with ^ in this file. | |
Here is a rough cheatsheet for syntax. | |
Key Modifiers |
/** | |
* Camelize a string, cutting the string by separator character. | |
* @param string Text to camelize | |
* @param string Word separator (underscore by default) | |
* @return string Camelized text | |
*/ | |
function camelize(text, separator) { | |
// Assume separator is _ if no one has been provided. | |
if(typeof(separator) == "undefined") { |
# NullStorage provider for CarrierWave for use in tests. Doesn't actually | |
# upload or store files but allows test to pass as if files were stored and | |
# the use of fixtures. | |
class NullStorage | |
attr_reader :uploader | |
def initialize(uploader) | |
@uploader = uploader | |
end |
require "active_record" | |
namespace :db do | |
db_config = YAML::load(File.open('config/database.yml')) | |
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
desc "Create the database" | |
task :create do | |
ActiveRecord::Base.establish_connection(db_config_admin) |
require 'json' | |
require 'yaml' | |
input_filename = ARGV[0] | |
output_filename = input_filename.sub(/(yml|yaml)$/, 'json') | |
input_file = File.open(input_filename, 'r') | |
input_yml = input_file.read | |
input_file.close |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000