Skip to content

Instantly share code, notes, and snippets.

View andyzinsser's full-sized avatar

Andy Zinsser andyzinsser

View GitHub Profile
@andyzinsser
andyzinsser / requestChallengeWithFilter.cs
Last active August 29, 2015 14:15
Example of requesting an Arbiter Cash Challenge with filters
Dictionary <string, string> filters = new Dictionary <string, string>();
filters.Add("level", "2");
filters.Add("sword", "excalibur");
filters.Add("grenades", "2");
Arbiter.RequestCashChallenge( filters, OnCashChallengeCreated, OnCashChallengeError );
@andyzinsser
andyzinsser / iOSBlurEffect.m
Last active August 29, 2015 14:06
iOS Blur Effect
#import "UIImage+ImageEffects.h"
// Take a snapshot of whatever view you want to blur
UIImage *image;
UIGraphicsBeginImageContext(myView.bounds.size);
[myView drawViewHierarchyInRect:myView.bounds afterScreenUpdates:true];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// Then set the background of whatever other view to be the blurry version of the snapshot
@andyzinsser
andyzinsser / delete_individual_south_migrations_table.md
Last active August 29, 2015 14:02
Delete individual rows of south table after deleting migrations for a single app

Delete migrations and app tables from database first. Then run sql below

./manage.py dbshell

SELECT * FROM south_migrationhistory WHERE app_name = '<APP_NAME>';
104 | social_auth | 0001_initial...                                                                   
105 | social_auth | 0002_auto__add_unique_nonce...

DELETE FROM south_migrationhistory WHERE app_name = '';
@andyzinsser
andyzinsser / index.md
Created June 4, 2014 17:37
Repro case for slate selected language bug
title language_tabs
API Reference
python

Introduction

Clicking 'Welcome to the intro' in the side bar will throw the error: Uncaught Error: Syntax error, unrecognized expression: .highlight. and then the python tab will become unselected and the code will dissapper.

using UnityEngine;
using System.Collections;
public class SpinningReel : MonoBehaviour {
private bool isSpinning = true;
public float smooth = 10f;
void Update () {
if (Input.GetKeyUp (KeyCode.S))
@andyzinsser
andyzinsser / psql_roles.sh
Last active August 29, 2015 13:55
Bare minimum commands for setting up postgres DB using psql
# All commands below are run within psql
psql
# List all roles
\du
# List all Databases
\list
# Adding a role 'august' with superuser privaleges
@andyzinsser
andyzinsser / client.m
Last active October 18, 2024 17:15
Full flow of authenticating a Game Center Player on a third party server.
// request Game Center verification data for localPlayer from apple
- (void)authenticateGameCenterPlayer:(GKLocalPlayer *)localPlayer
{
[localPlayer generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) {
if (error) {
NSLog(@"ERROR: %@", error);
}
else {
// package data to be sent to server for verification
NSDictionary *params = @{@"publicKeyUrl": publicKeyUrl,
@andyzinsser
andyzinsser / walk_through_south_migrations.py
Created November 14, 2013 05:55
Example of walking through app south migration history. While trying to solve some migration issues from renaming multiple models at once, I delete a few tables in an attempt to resolve my issues. That only caused more problems. Probably would have been better off to rename one model, then rename the other. Regardless, this got everything back u…
# Gets both apps with relating models back to square one.
python manage.py migrate APP_1 zero
python manage.py migrate APP_2 zero
# At this point, there were models in APP_1 initial migration that no longer existed.
# So I couldn't just run all the APP_1 migrations at once
# Step through history
python manage.py migrate APP_1 0001
python manage.py migrate APP_2 0001
@andyzinsser
andyzinsser / gist:6033182
Last active December 19, 2015 23:18
When npm install complains about not having access / permission. Should be a one time fix. Taken from http://howtonode.org/introduction-to-npm
sudo chown -R $USER /usr/local
@andyzinsser
andyzinsser / robot.js
Created December 4, 2012 16:18
Meany
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.fire();