Skip to content

Instantly share code, notes, and snippets.

@smoil
smoil / account.rb
Last active March 2, 2020 00:32
Ajax select/multi select in Rails using Select2
class Account < ActiveRecord::Base
def self.search(name = nil)
# search logic
end
end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[JBViewController alloc] initWithNibName:@"JBViewController" bundle:nil];
self.window.rootViewController = self.viewController;
// ADD THIS LINE:
[self.window setTransform:CGAffineTransformMakeScale(0.81, 0.81)];
@arkadiyk
arkadiyk / excel_dumper.rb
Created September 30, 2011 01:15
Export data to Excel. Nicely formatted, with correct datatypes, text wrap for long fields.
class ExcelDumper
def initialize(array)
@data = array
end
def to_xls(options = {})
output = %{<?xml version="1.0" encoding="UTF-8"?>
<Workbook xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"