Skip to content

Instantly share code, notes, and snippets.

View typeoneerror's full-sized avatar
🤠
iOS, Capacitor, Ember, Vue, Rails

Benjamin Borowski typeoneerror

🤠
iOS, Capacitor, Ember, Vue, Rails
View GitHub Profile
@typeoneerror
typeoneerror / svn_del.sh
Created August 8, 2011 04:57
Remove deleted files from svn
function svn_del
{
svn status | grep '\!' | awk '{print $2;}' | xargs svn rm;
}
// the old way
#pragma mark -
#pragma mark Section Name
// the new way
#pragma mark - Section Name
@typeoneerror
typeoneerror / .bash_profle
Created July 25, 2011 16:50
.bash_* postgreSQL 9.0 on Mac helpers
function pg_restart
{
echo "Restarting PostgreSQL server..."
sudo su postgres -c "/Library/PostgreSQL/9.0/bin/pg_ctl -wD /Library/PostgreSQL/9.0/data restart"
}
function pg_start
{
echo "Starting PostgreSQL server..."
sudo su postgres -c "/Library/PostgreSQL/9.0/bin/pg_ctl -wD /Library/PostgreSQL/9.0/data start"
@typeoneerror
typeoneerror / environment.rb
Created July 20, 2011 21:25
Hacking in bigint support for Mysql and Postgresql. Got a better method?
# Load the rails application
require File.expand_path('../application', __FILE__)
require 'active_record/connection_adapters/mysql2_adapter'
require 'active_record/connection_adapters/postgresql_adapter'
ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES[:big_primary_key] = "BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY".freeze
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:big_primary_key] = "bigserial primary key".freeze
# Initialize the rails application
@typeoneerror
typeoneerror / gist:1052453
Created June 28, 2011 22:51
decorator hell
/**
* Load the default decorators for forms.
*
* @return Typeoneerror_Form Reference to form instance
*/
public function loadDefaultDecorators()
{
// wipe all
$this->clearDecorators();
@typeoneerror
typeoneerror / gist:1001461
Created May 31, 2011 22:59
gamekit packets
/** Types of packets sent by session. */
typedef enum {
PacketTypeStart, /**> packet to notify games to start. */
PacketTypeRequestSetup, /**> server wants client info. */
PacketTypeSetup, /**> send client info to server. */
PacketTypeSetupComplete, /**> round trip made for completion. */
PacketTypeTurn, /**> packet to notify game that a turn is up. */
PacketTypeRoll, /**> packet to send roll to players. */
PacketTypeEnd, /**> packet to end game. */
PacketTypeHeartbeat, /**> packet to attempt to keep peers alive. */
@typeoneerror
typeoneerror / multilines.m
Created April 21, 2011 01:25
multilines.m
- (void)doTheThing
{
if (TRUE)
[self doSomething];
else
[self doSomethingElse];
NSLog(@"will always run, but looks like part of else");
}
@typeoneerror
typeoneerror / ActivityAsyncTask.java
Created February 9, 2011 09:04
abstract class to run in non-UI thread, and load an XML file into value objects
/*
* Copyright (c) 2011 Typeoneerror Studios LLC
* $Id$
*/
package com.typeoneerror.apps.application.tasks;
import android.util.Log;
import com.typeoneerror.apps.application.io.ActivityFeedHandler;
import com.typeoneerror.apps.application.model.Model;
private View buildIndicator(int imageResource, int stringResource)
{
final Button indicator = (Button)getLayoutInflater().inflate(R.layout.navigation_item, getTabWidget(), false);
indicator.setCompoundDrawables(null, resources.getDrawable(imageResource), null, null); // LTRB
indicator.setText(resources.getString(stringResource));
return indicator;
}
//die();
require_once "../setup.php";
require_once "bootstrap.php";
require_once "apps.php";
foreach ($apps as $name => $env)
{
$clientId = $env[0];
$appSecret = $env[1];