Skip to content

Instantly share code, notes, and snippets.

@danstepanov
danstepanov / FruitCorners.txt
Created March 30, 2023 02:47 — forked from macserv/FruitCorners.txt
A brief history of the Fruit Corners brand (1980–1987) from General Mills
Thank you for contacting General Mills with your inquiry. We have enclosed all information we have available regarding the Fruit Corners line of products.
We hope you find this information helpful. Please let us know if we can help you again
Sincerely,
Katie Gafler
Consumer Services
@danstepanov
danstepanov / .gitconfig
Last active April 18, 2023 19:58
Useful git aliases
[alias]
co = checkout
cob = checkout -b
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cm = !git add -A && git commit -m
bclean = "!f() { git branch --merged ${1-main} | grep -v "${1-main}$" | xargs git branch -d; }; f"
bdone = "!f() { git co ${1-main} && git up && git bclean ${1-main}; }; f"
po = push origin
st = status
undolastcommit = reset HEAD~
@danstepanov
danstepanov / jwtAuth.ts
Created January 15, 2020 00:00
JWT Authentication
import axios from 'axios';
import { AsyncStorage } from 'react-native';
import jwtDecode from 'jwt-decode';
const setAuthToken = async () => {
const authorizationToken = await AsyncStorage.getItem('@token');
axios.defaults.headers.common['Authorization'] = authorizationToken;
};
export default const authenticateUser = async (email: String, password: String) => {
tell application "Simulator"
activate
end tell
tell application "System Events"
tell process "Simulator"
tell menu bar 1
tell menu bar item "Simulator"
tell menu "Simulator"
click menu item "Reset Content and Settings…"
@danstepanov
danstepanov / logAllFonts.swift
Created March 7, 2016 23:57
This snippet will log all available fonts for the current project to the console
// ADDING FONTS TO PROJECT
//
// 1. Add font to project
// 2. Make sure in project file, the fonts are in "Copy Bundle Resources" under "Build Phases"
// 3. Add font file names to Info.plist "Fonts provided by Application"
// 4. Use code below to print the name used by UIFont; it might not be what you expect.
for (NSString *familyName in [UIFont familyNames]) {
NSLog(@"%@", familyName);
for (NSString *name in [UIFont fontNamesForFamilyName:familyName]) {
func labelConstraints() {
// Center button in Page View
NSLayoutConstraint(
item: label,
attribute: .CenterX,
relatedBy: .Equal,
toItem: view,
attribute: .CenterX,
multiplier: 1.0,
constant: 0.0)
func buttonConstraints() {
// Center button in Page View
NSLayoutConstraint(
item: button,
attribute: .CenterX,
relatedBy: .Equal,
toItem: view,
attribute: .CenterX,
multiplier: 1.0,
constant: 0.0)
lazy var button: UIButton! = {
let view = UIButton()
view.translatesAutoresizingMaskIntoConstraints = false
view.addTarget(self, action: "buttonPressed", forControlEvents: .TouchDown)
view.setTitle("Press Me!", forState: .Normal)
return view
}()
import UIKit
class MainViewController: UIViewController, UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(textField)
view.setNeedsUpdateConstraints()
}
func textFieldConstraints() {
// Center Text Field Relative to Page View
NSLayoutConstraint(
item: textField,
attribute: .CenterX,
relatedBy: .Equal,
toItem: view,
attribute: .CenterX,
multiplier: 1.0,
constant: 0.0)