Skip to content

Instantly share code, notes, and snippets.

@faoiseamh
faoiseamh / neighborhoods.swift
Last active February 14, 2016 00:35 — forked from abelesmw/neighborhoods.swift
Grab neighborhood by user location
//
// ViewController.swift
// Find Your Hood
//
// Created by Mark Abeles
// Copyright (c) 2016 Mabeles. All rights reserved.
//
import UIKit
import CoreLocation
@faoiseamh
faoiseamh / gist:08fab11a2dfb7ace4192
Created May 13, 2015 19:19
Ruby keyword arguments wtf
class Demo1
def initialize a:, b:
@a = a
@b = b
puts "@a = #{@a.inspect} and @b = #{@b.inspect}"
end
end
Demo1.new a: 'one', b: 'two'
# ==> @a = nil and @b = "two"
@faoiseamh
faoiseamh / gist:9a478944befffb19760b
Created May 12, 2014 13:37
Crypt keeper decrypted fields in large queries
# Not a very elegant solution. I'd love to build something along these lines but more automated into crypt_keeper when I have more time.
module EncryptionHelper
def self.mysql_decrypted_field(field_name, options = {})
options[:as] = "#{field_name.gsub('.','_')}_decrypted" unless options[:as] == false
decrypt_query = "AES_DECRYPT(from_base64(#{field_name}), '#{MyApp::Application.config.crypt_passphrase}')"
decrypt_query << " AS #{options[:as]}" unless options[:as] == false
decrypt_query