Skip to content

Instantly share code, notes, and snippets.

@bleeckerj
bleeckerj / userAvatar.js
Created February 6, 2018 07:42 — forked from SylarRuby/userAvatar.js
NodeJs AWS S3 Upload
/**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* This code is used in my startup, Zired.
* Web: http://zired.io
*/
// You can either "yarn add aws-sdk" or "npm i aws-sdk"
const AWS = require('aws-sdk')
@bleeckerj
bleeckerj / UIImageFixedOrientationExtension.swift
Created January 11, 2018 20:46 — forked from schickling/UIImageFixedOrientationExtension.swift
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@bleeckerj
bleeckerj / gist:bc6f229dbd8095a08d9db9e2eda1f022
Created December 17, 2017 16:00
Set an Info.plist entry for basic git info, useful for creating a bit of internal info on what code is actually being run.
# do not assign the new build number if there is no changes
DIFF=`git diff`
if [[ $DIFF == "" ]]; then exit 0; fi
# path to the property list where the version number should be changed
PLIST="${PROJECT_DIR}/${INFOPLIST_FILE}"
SETTINGSPLIST="Settings.bundle/Information.plist"
# Name of the branch
BRANCH_NAME=`git branch | grep \* | cut -d ' ' -f2`
@bleeckerj
bleeckerj / crc32.swift
Created December 16, 2017 16:24 — forked from JALsnipe/crc32.swift
crc32 implemented in Swift (Swift 3)
//
// crc32.swift
// SuperSFV
//
// Created by C.W. Betts on 8/23/15.
//
//
/* crc32.swift -- compute the CRC-32 of a data stream
Copyright (C) 1995-1998 Mark Adler
Copyright (C) 2015 C.W. "Madd the Sane" Betts
@bleeckerj
bleeckerj / xcode-build-bump.sh
Created December 11, 2017 16:18 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@bleeckerj
bleeckerj / DispatchSemaphore Test
Created December 10, 2017 15:50
Wait for an Asynchronous Operation in a Loop/Iterator
//
// ViewController.swift
// DispatchGroupTest
//
// Created by Julian Bleecker on 12/9/17.
// Copyright © 2017 Near Future Laboratory. All rights reserved.
//
import UIKit
@bleeckerj
bleeckerj / .gitignore
Created December 6, 2017 22:27 — forked from pholas/.gitignore
.gitignore for Xcode 8 and Swift 3
## OS X files
.DS_Store
.DS_Store?
.Trashes
.Spotlight-V100
*.swp
## Xcode build files
DerivedData/
build/
@bleeckerj
bleeckerj / uiimage_combine.swift
Created November 25, 2017 15:55 — forked from A-Zak/uiimage_combine.swift
UIImage extension to combine two images
extension UIImage {
class func imageByCombiningImage(firstImage: UIImage, withImage secondImage: UIImage) -> UIImage {
let newImageWidth = max(firstImage.size.width, secondImage.size.width )
let newImageHeight = max(firstImage.size.height, secondImage.size.height)
let newImageSize = CGSize(width : newImageWidth, height: newImageHeight)
UIGraphicsBeginImageContextWithOptions(newImageSize, false, UIScreen.mainScreen().scale)
@bleeckerj
bleeckerj / toastr.fontawesome.css
Created November 6, 2017 03:41 — forked from askehansen/toastr.fontawesome.css
toastr fontawesome
#toast-container > .toast {
background-image: none !important;
}
#toast-container > .toast:before {
position: fixed;
font-family: FontAwesome;
font-size: 24px;
line-height: 18px;
float: left;
@bleeckerj
bleeckerj / Sequence+Helpers.swift
Created July 22, 2017 00:15 — forked from khanlou/Swift2.swift
`any`, `all`, `none`, `first`, and `count` on SequenceType in Swift
extension Sequence {
func any(_ predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Bool {
for element in self {
let result = try predicate(element)
if result {
return true
}
}
return false