How to manage polymorphic associations with simple_form and JQuery?
This is a solution.
.
├── app
│ ├── assets
# Origin: http://stackoverflow.com/users/1259292/yusumishi | |
import win32com.client | |
import pythoncom | |
import re | |
class Handler_Class(object): | |
def OnNewMailEx(self, receivedItemsIDs): | |
# RecrivedItemIDs is a collection of mail IDs separated by a ",". | |
# You know, sometimes more than 1 mail is received at the same moment. |
def get_ssl_username | |
request.env["REMOTE_USER"] | |
end |
#!/bin/bash | |
# | |
# csvget -- use csvkit too get a specific field value | |
# | |
# Usage: csvget <field_name> <line_number> | |
# get the field <field_name> value at the <line_number>th line | |
FieldName=${1:?} | |
N=${2:?} |
# config/application.rb | |
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
Bundler.require(:default, Rails.env) | |
module App | |
class Application < Rails::Application |
# Nothing to require | |
# You can define your seed or generate one using system random function | |
seed = srand | |
prng = Random.new(seed) | |
# Generate X bytes | |
X = 16 | |
bin_str = prng.bytes(X) |
# crontab -e | |
0 4 * * * sync; echo 3 > /proc/sys/vm/drop_caches |
# message is Mail::Message | |
# see http://www.rubydoc.info/github/mikel/mail/Mail/Message | |
message.attachments.each do |attch| | |
f = Tempfile.new(attch.filename, Rails.root.join('tmp')) | |
puts " - Save #{attch.filename} to #{f.path}" | |
begin | |
f.binmode | |
f.write attch.decoded | |
ensure |
class RouteRecognizer | |
attr_reader :paths | |
# To use this inside your app, call: | |
# `RouteRecognizer.new.initial_path_segments` | |
# This returns an array, e.g.: ['assets','blog','team','faq','users'] | |
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)} | |
def initialize |