Skip to content

Instantly share code, notes, and snippets.

View tonespy's full-sized avatar
🙄
Lol...

Abubakar Oladeji tonespy

🙄
Lol...
  • Netherlands
View GitHub Profile
@tonespy
tonespy / build.gradle
Last active March 3, 2017 14:30
Gradle Build, build types
signingConfigs {
debug {
print(file(keystoreProperties['storeFile']))
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
release {
@Reusable
public class Migration implements RealmMigration
{
private Map<Integer, Provider<VersionMigration>> versionMigrations;
@Inject
Migration (Map<Integer, Provider<VersionMigration>> versionMigrations)
{
this.versionMigrations = versionMigrations;
}
@tonespy
tonespy / ExampleUnitTest.java
Last active June 11, 2017 16:27
A string occurrence check
public class ExampleUnitTest {
private final String xterRegex = "[;\\\\:*?\\\"<>|&']";
private final String alphanumericRegex = "^[a-zA-Z0-9]*$";
@Test
public void addition_isCorrect() throws Exception {
System.out.println("====================================");
//System.out.println("+".matches("[^A-Za-z0-9]"));
System.out.println(acceptedPattern("They've"));
@tonespy
tonespy / gist:5148e055b5c45d0baa53db017ee89a17
Created July 3, 2017 00:13 — forked from steipete/ios-xcode-device-support.sh
Using iOS 10.3 devices with Xcode 8.2.1
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// Updated on Jan 24th, 2017 for Xcode 8.3b1
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.3\ \(14E5230d\)/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
@tonespy
tonespy / gist:8228f771912300732c41901b99dd0c97
Created December 31, 2017 16:25 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@tonespy
tonespy / GenerateMultipleColorString.swift
Last active March 8, 2018 10:04
NSMutableAttributedString Implementation
import UIKit
extension NSMutableAttributedString {
func generateMultipleColorString(sentences: [String], colors: [UIColor]) -> NSMutableAttributedString? {
let attributedText = NSMutableAttributedString()
var count = 0
while count < sentences.count {
let minAttr = NSMutableAttributedString(string: sentences[count])
@tonespy
tonespy / Usage.swift
Last active March 8, 2018 10:03
MutableStrings
let aggreementLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 15)
label.textColor = UIColor.textfieldTextColor()
label.numberOfLines = 0
let titles = ["I agree to the", " terms and conditions", " and confirm that the information I have provided is accurate."]
let colors = [UIColor.authTextGray(), UIColor.appColor(), UIColor.authTextGray()]
let attributedText = NSMutableAttributedString().generateMultipleColorString(sentences: titles, colors: colors)
if let attributedText = attributedText {
label.attributedText = attributedText
@tonespy
tonespy / pr.md
Created May 1, 2018 07:04 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tonespy
tonespy / logger.go
Created June 23, 2019 08:18
API Logger
package app
import (
"log"
"net/http"
"time"
"github.com/julienschmidt/httprouter"
)
@tonespy
tonespy / user.go
Created June 23, 2019 08:27
User Model
package models
import "strconv"
type missingFieldError string
func (m missingFieldError) Error() string {
return string(m) + " is required"
}