This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SWIFT_LINT=./Pods/SwiftLint/swiftlint | |
if [[ -e "${SWIFT_LINT}" ]]; then | |
# Export files in SCRIPT_INPUT_FILE_$count to lint against later | |
count=0 | |
while IFS= read -r file_path; do | |
export SCRIPT_INPUT_FILE_$count="$file_path" | |
count=$((count + 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
do { | |
try fetchedResultsController.performFetch() | |
} catch { | |
print("Error") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
``` | |
// Encode a model with properties of type [String : Any] | |
var propertiesContainer = container.nestedContainer(keyedBy: DynamicKey.self, forKey: .properties) | |
if let properties = properties { | |
try propertiesContainer.encodeDynamicKeyValues(withDictionary: properties) | |
} | |
``` | |
*/ | |
struct DynamicKey: CodingKey { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
func resizedImage(newSize:CGSize) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0); | |
self.drawInRect(CGRectMake(0, 0, newSize.width, newSize.height)) | |
let newImage: UIImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return newImage | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"images" : [ | |
{ | |
"size" : "29x29", | |
"idiom" : "iphone", | |
"filename" : "app-icon-58.png", | |
"scale" : "2x" | |
}, | |
{ | |
"size" : "40x40", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Mocha Guide to Testing | |
// Objective is to explain describe(), it(), and before()/etc hooks | |
// 1. `describe()` is merely for grouping, which you can nest as deep | |
// 2. `it()` is a test case | |
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run | |
// before/after first/each it() or describe(). | |
// | |
// Which means, `before()` is run before first it()/describe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<FrameLayout | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:layout_alignParentTop="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.stopwatch; | |
import android.os.Bundle; | |
import android.app.Activity; | |
import android.os.Handler; | |
import android.view.Menu; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.TextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String computeHoiioSignature(byte[] payload, String accessToken) { | |
MessageDigest md = MessageDigest.getInstance("SHA-256"); | |
md.update(payload); | |
md.update(accessToken.getBytes("UTF-8")); | |
byte[] bytes = md.digest(); | |
String mySign = Hex.encodeHexString(bytes); | |
return mySign; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function computeHoiioSignature($payload, $accessToken) { | |
// hash_hmac will return a hex of the digest | |
$signature =hash_hmac('sha256', $payload, $accessToken); | |
return $signature; | |
} | |
?> |
NewerOlder