Skip to content

Instantly share code, notes, and snippets.

View iwasrobbed's full-sized avatar
:shipit:
"1 billion years".Save()

rob phillips iwasrobbed

:shipit:
"1 billion years".Save()
View GitHub Profile
class ImportController << ApplicationController
require 'net/http'
require 'net/https'
require 'uri'
#THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE.
def authenticate
# initiate authentication w/ gmail
# create url with url-encoded params to initiate connection with contacts api
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false" />
</cross-domain-policy>
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
class ImageUploader < CarrierWave::Uploader::Base
# include MiniMagick support for resizing images
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
# (handled in the initializer file)
# storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
@iwasrobbed
iwasrobbed / gist:1032395
Created June 17, 2011 21:29
Amazon S3 Query String Authentication for Ruby on Rails
def generate_secure_s3_url(s3_key)
#
# s3_key would be a path (including filename) to the file like: "folder/subfolder/filename.jpg"
# but it should NOT contain the bucket name or a leading forward-slash
#
# this was built using these instructions:
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html
# http://aws.amazon.com/code/199?_encoding=UTF8&jiveRedirect=1
s3_base_url = MyApp::Application::S3_BASE_URL # i.e. https://mybucket.s3.amazonaws.com
@iwasrobbed
iwasrobbed / 0_reuse_code.js
Created June 16, 2016 19:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@iwasrobbed
iwasrobbed / me360.md
Created July 29, 2019 14:08
Me360 looking for first hire, full stack engineer

Me360 is a start up focused on delivering effective employee training at scale for high impact professional skills. I (founder) have been collaborating with a great engineer friend and former colleague to develop the initial versions of the product, and now with some market traction it's time to formalize a small core team.

I'm looking to hire the first full-time fullstack engineer for the company who would own all the technical work and direction for the next year. We'd work very closely together (I have a product and start up background), alongside a contract designer. After year one, they'd likely build out their team.

This company has ambitions to be a high growth tech company and deliver a meaningful solution to help professionals advance their careers with really powerful skills. It's a great opportunity for someone who's interested in this mission, who enjoys start up life and quick release cycles, and who's a dynamic problem solver at introducing relevant technologies to

@iwasrobbed
iwasrobbed / example_hud.swift
Last active November 25, 2019 07:27
Example of how to create a HUD in Swift 3
//
// HUD.swift
//
// Created for a coding challenge called FoodDictator
//
// This example relies on SwiftyGif to show an animated GIF for progress,
// but you could just as easily replace it with something like RPCircularProgress.
//
// Links for both are below:
// SwiftyGif: https://github.com/kirualex/SwiftyGif
@iwasrobbed
iwasrobbed / gist:5528897
Last active June 5, 2020 20:34
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;
final class CurrencySymbol {
static let shared = CurrencySymbol()
/// Finds the shortest currency symbol possible and formats the amount with it
/// Note: this works around using `currencyCode` and how it displays `CA$1234.56` instead of `$1234.56`
func currencyString(for amount: Decimal, isoCurrencyCode: String?) -> String {
guard let isoCurrencyCode = isoCurrencyCode,
let currencySymbol = findSymbol(for: isoCurrencyCode)
else { return String(describing: amount) }
return formatter(for: currencySymbol).string(for: amount) ?? String(describing: amount)