Skip to content

Instantly share code, notes, and snippets.

View sjehutch's full-sized avatar

scott hutchinson sjehutch

View GitHub Profile
@sjehutch
sjehutch / gradient helper.cs
Created January 5, 2018 03:07
xamarin IOS gradient view
public void GradientHelper (UIColor colorOne , UIColor colorTwo , UIView myView)
{
var gradientLayer = new CAGradientLayer();
myView.Frame = myView.Bounds;
gradientLayer.Colors = gradientLayer.Colors = new[] { colorOne.CGColor, colorTwo.CGColor };
gradientLayer.Locations = new NSNumber[] { 0, 1 };
gradientLayer.StartPoint = new CoreGraphics.CGPoint(x: 1.0, y:1.0);
gradientLayer.EndPoint = new CoreGraphics.CGPoint(x: 0.0, y: 0.0);
public override void ViewDidLoad()
{
base.ViewDidLoad();
var lightBlur = UIBlurEffect.FromStyle(style: UIBlurEffectStyle.Dark);
var blurView = new UIVisualEffectView(lightBlur)
{
Alpha = 50f,
Frame = imgBack.Frame
@sjehutch
sjehutch / RotateImage.swift
Last active January 27, 2018 17:10
rotate image-swift
extension UIView {
func rotate360Degrees(duration: CFTimeInterval = 3) {
let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation")
rotateAnimation.fromValue = 0.0
rotateAnimation.toValue = CGFloat(Double.pi * 2)
rotateAnimation.isRemovedOnCompletion = false
rotateAnimation.duration = duration
rotateAnimation.repeatCount=Float.infinity
self.layer.add(rotateAnimation, forKey: nil)
}
@sjehutch
sjehutch / Commit-Guide.md
Created January 29, 2018 13:48
Commit Guidelines

Commit Guidelines

We like commits to be clear, concise and easy to review. To achieve this, keep your commits as small and specific as possible.

For a discussion on the importance of good commit messages, please see this article.

When writing commit messages follow these rules:

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move file to..." not "Moves file to...")
@sjehutch
sjehutch / Pull-Request-Etiquette.md
Created January 29, 2018 13:49
Pull Request Etiquette

Pull Request Etiquette

Our goal as the mobile developers is to create apps of the highest quality in terms of both the user experience and the code base.

All code changes to our apps are added using GitHub's pull requests. To be able to merge a pull request, it has pass unit tests and be approved by at least one other developer. Therefore it is of supreme importance that each pull request is as easy to review as possible. To facilitate this, follow these guidelines:

  1. Pull requests should always result in a functional app and never knowingly introduce bugs or other bad behaviour
  2. Pull requests should be as small and straight forward as possible
    • Each pull request should make a single clearly defined change or addition
  • Change as many files as necessary, but as few as possible
@sjehutch
sjehutch / Super-Flow.md
Last active January 29, 2018 13:53
SuperFlow(Gitflow)

SuperFlow: branching work flow

To ensure - as much as possible - the quality and correctness of our code, and to enable many contributors to work on our apps at the same time without getting in each other's way we use a modified version of the GitFlow work flow by Vincent Driessen.

We call this work flow SuperFlow.

Below you will find Vincent's original diagram adapted and extended corresponding to SuperFlow followed by an explanation of the various concepts and steps involved.

SuperFlow

@sjehutch
sjehutch / SREQ-DETAILS.cs
Created January 29, 2018 15:10
SREQ-details
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using sitehands;
//
// var data = Sreq.FromJson(jsonString);
namespace sitehands
{
using System;
using System.Net;
@sjehutch
sjehutch / all_aws_lambda_modules.txt
Created February 24, 2018 07:39 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules and post the list to Pastebin
# module list (generated by listmodules.py)
#
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
#
BaseHTTPServer
Bastion
CDROM
@sjehutch
sjehutch / gcd.swift
Last active February 26, 2018 05:11
GCD Async / Sync / Serial / Concurrent
func doLongAsyncTaskInSerialQueue() {
let serialQueue = DispatchQueue(label: "com.queue.Serial")
for i in 1...5 {
serialQueue.async {
if Thread.isMainThread{
print("task running in main thread")
}else{
print("task running in background thread")
@sjehutch
sjehutch / FindScott.swift
Created March 2, 2018 09:35
Swift Generics Find Function
import UIKit
func existsScott(item:String, inArray:[String]) -> Bool
{
var index:Int = 0
var found = false
while (index < inArray.count && found == false)
{