Optimize non-Apple SSDs on OS X. (Run the following commands in the terminal.)
Enable TRIM support
Check IOAHCIBlockStorage version:
open /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/version.plist
module ActiveSupport | |
# Wrapping a string in this class gives you a prettier way to test | |
# for equality. The value returned by <tt>Rails.env</tt> is wrapped | |
# in a StringInquirer object so instead of calling this: | |
# | |
# Rails.env == "production" | |
# | |
# you can call this: | |
# | |
# Rails.env.production? |
module Paperclip | |
class Attachment | |
class UploadedPath | |
attr_reader :original_filename, :content_type, :size, :path | |
def initialize(uploaded_file) | |
@original_filename = uploaded_file["name"].downcase | |
@content_type = uploaded_file["content_type"].to_s.strip | |
@file_size = uploaded_file["size"].to_i | |
@path = uploaded_file["path"] |
location = /videos/ { | |
upload_pass_form_field "^video"; | |
upload_store /path/to/your/app/tmp/upload; | |
upload_pass @large_upload; | |
upload_pass_args on; | |
upload_store_access all:rw; | |
upload_set_form_field "$upload_field_name[name]" "$upload_file_name"; | |
upload_set_form_field "$upload_field_name[content_type]" "$upload_content_type"; | |
upload_set_form_field "$upload_field_name[path]" "$upload_tmp_path"; | |
upload_aggregate_form_field "$upload_field_name[md5]" "$upload_file_md5"; |
# config/initializers/postgresql_patches.rb | |
module ActiveRecord | |
module ConnectionAdapters | |
class PostgreSQLAdapter | |
def quote_table_name(name) | |
schema, name_part = extract_pg_identifier_from_name(name.to_s) | |
return quote_column_name(schema) unless name_part | |
table_name, name_part = extract_pg_identifier_from_name(name_part) | |
"#{quote_column_name(schema)}.#{quote_column_name(table_name)}" |
Optimize non-Apple SSDs on OS X. (Run the following commands in the terminal.)
Check IOAHCIBlockStorage version:
open /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/version.plist
#!/bin/sh | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' |
This is an example of how I combine interaction/service classes with Wisper event broadcasting in Rails.
In this example, I show a UsersController#create
API, a corresponding service object, and all the test code/listeners to make it all happen.
The outcome is:
object.save
in dozens of places.grep
for usage of it.I hereby claim:
To claim this, I am signing this object:
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script> | |
<style> | |
body {padding:0; margin:0} | |
.container {display:flex; flex-wrap: wrap;} | |
.child {flex-grow: 1; width:50%; height:33.3vh;} | |
</style> | |
<div class='container'> | |
<div class='child'> | |
<script type="text/javascript"> | |
new TradingView.widget({ |
PEER_PORT=11635 | |
HTTP_PORT=11636 | |
DATABASE="postgresql://dbname=stellar-bug user=stellar" | |
LOG_FILE_PATH="/var/log/stellar/stellar-core-bug.log" | |
BUCKET_DIR_PATH="/var/lib/stellar/buckets-bug" | |
NETWORK_PASSPHRASE="Test SDF Network ; September 2015" | |
KNOWN_PEERS=[ |