Joshua Oiknine

Developer of things at Port:9. Gramsby.me was the latest now there is The Regram App available in the app store.

about.me/joshOiknine

Video reblogged from Made With Paper

madewithpaper:

INTRODUCING PENCIL. Think With Your Hands.

Great tools inspire great ideas. We could not be more excited to announce Pencil, a new hardware accessory for Paper, and the latest in our essential suite of mobile tools for creativity. Pencil is the most natural and expressive tool for getting ideas on Paper—a beautiful blend of advanced technology and artisanal craft. Pencil’s special expressive features: Erase, Blend, and adaptive Palm Rejection, open up a whole new world of creative possibilities in Paper.

Learn more: fiftythree.com/pencil


  • Show the world we want a phone worth keeping! #phonebloks


 http://thndr.it/15eLEMU

Show the world we want a phone worth keeping! #phonebloks


http://thndr.it/15eLEMU


  • #ios7 #hadto

#ios7 #hadto


There are a few tutorials out there the describe how to connect and compile php binaries (libraries) for Heroku but I didn’t find anything that gave the complete process and I wanted to outline that process here. I have also been building a github repo with the results of my labors which you can find here https://github.com/joshOiknine/php-heroku-extensions.

First let’s get onto the heroku instance:

cd /myApp
heroku run bash

Move to your tmp directory:

$: cd /tmp

Download your source and extract the files. For this example we will download PHP using curl but you could also use git clone for git repositories:

$: curl http://www.php.net/distributions/php-5.4.15.tar.gz > php-5.4.15.tar.gz
$: tar xzf php-5.4.15.tar.gz

At this point you can complie all of PHP with the extentions you want then go find them but I like navigating to the extention I want to build and compiling it from there. Let’s compile zip:

$: cd php-5.4.15/ext/zip
$: /app/php/bin/phpize
$: ./configure --with-php-config=/app/php/bin/php-config
$: make

If everything works out then you will have your zip.so file in the modules directory:

$: cd modules/
$: ls -l

Now the fun part getting the files off this instance of Heroku. The problem we are now facing is that once you exit the bash session on Heroku all of your previous work is gone. The simples way I found was to SFTP the files off of Heroku to another server but just in case you don’t have an extra server lying around that is accessible I found using PagodaBox as a great free option. You can set up an account with PagodaBox and set it to run in legacy SFTP mode.  Then all you need to do is SFTP the files from Heroku to PagodaBox.

$: sftp instance-name@pagodabox.com
sftp> put zip.so
sfpt> exit
$: exit

Now you are safe to exit the Hekou bash shell.

Next you will need to download this extension and put it in your project. I usually make a ext folder in my project’s root directory for these files.

mkdir ext
cd ext
sftp instance-name@pagodabox.com
sftp> get zip.so

The last step before you push your changes to Heroku is to make a php.ini file and include this extension in it.

cd ..
nano php.ini

Once in the ini file add the extension like so:

extension_dir = "/app/www/ext/"
extension=zip.so

Save the php.ini file. Commit your changes to git and push to Heroku.

If you are having any issues or need a library compiled check my github repo at https://github.com/joshOiknine/php-heroku-extensions.


Ever wanted to use the default Pintrest button but wanted to make it a little larger? With a little CSS hacking it’s pretty simple. It is important here to include a wrapper around the button in order to have a more specific target than the default styles from Pintrest.

Here is how I did it.

Markup:

<div class="pintrest-button">
    <a data-pin-config="none" href="//pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png"></a>
</div>

CSS:

.pintrest-button a[class*='PIN_'] {
    background-size: 50px 69px!important;
    background-position: 0 -23px;
    height: 23px!important;
    width: 50px!important;
}
.pintrest-button a[class*='_hazClick'] {
    background-position: 0 -46px!important;
}

Happy pinning!


A little recipe I worked up that is proven to help anyone succeed.

    class recipie_for_success {
    
        function __construct() {
            $this->try_to_succeed();
        }
    
        function try_to_succeed() {
    
            $successful = $this->try_something();
    
            if (!$successful) {
                return $this->try_to_succeed();
            } else {
                return true;
            }
        }
    
        function try_something() {
            return  $it_worked;
        }
    }

image

I have to say that I love the twitter website. Since they actually put some focus on the web interface to their platform last year it has come around. It has all the details I need/want about a given tweet just a few clicks away. Also the ability to view images/video right on twitter’s site makes my browser (that already has 30+ tabs open) happy.

Another great thing about twitter is their open source efforts. Bootstrap CSS has made throwing together a new site much simpler. Also their use of jQuery makes this hack so much easier.

image

The one thing about twitter is they are a business and they need to make money so we now have promoted… everything, from Tweets to Users to Trends.

Now for the Hack… Ever wanted to strip out those “Promoted Things”? Here is simple way to do it with jQuery:

$(document).ready(function(){
    // Remove Tweets
    $("div.promoted-tweet").each(function(){
        $(this).parent().remove()}
    );
    // Remove Users
    $("div.promoted-account").each(function(){
        $(this).remove()
    });
    // Remove Trends
    $("li.promoted-trend").each(function(){
        $(this).remove()
    })
});

To make it easier just throw this into a bookmarklet and you are good to go. Just wrap the above with “javascript:(<code goes here>);”. I can’t seem to make the link using Posterous.

Maybe oneday I will get bored and make a chrome extention to run this when the page loads =)


I recently was introduced to Heroku and find that it is great in a few ways. First deploying from Git is simple and easy as long as you have dotted your i’s and crossed your t’s. Also you can show proof of concepts or stage projects in progress quickly and with no costs.

Downside is I’ve been working on PHP for many years and they lack support for PHP. Eitherway I have been learning RoR and Python so Heroku becomes a great option.

My first experience was with RoR on a proof of concept project and this went pretty smooth. Heroku creates your database using the Rails YAML file and even replaces configurations with whatever it find necessary. There is also tons of documentation and posts all over the web for deploying RoR on Heroku

Next I started working on a Python project using web.py. I was making a simple API mashup and didn’t have a database behind the project. For this combination I found that there is not much documentation but since Heroku has support for Python and other frameworks have some documentation I muddled through and get it working. Now there are a few things that you should know to get web.py running.

You are going to need to have a Virtualenv set up.  To do this in a terminal simply navigate to your applications directory and run the install command:

$: cd /path/to/my/app
$: virtualenv venv --distribute

Next if you have any dependencies you need to install them in the Virtualenv.  If you do not have any dependencies you still need to set up a requirements.txt file to let Heroku know. Activate your virtual environment and install you requirements then use the following command to generate your requirements.txt file:

$: pip freeze > requirements.txt

And the last part that is required is for you to create a Procfile to tell Heroku how to start you application.  I found it easier to just manually create a file named Procfile in my root directory and add the command to start my application.  Mine looked like this:

web: python service.py    

Great now we should be all ready to go. But wait there is one more issue I ran into. Heroku assigns a port to your application each time you push code from Git. So the default port of 8080 that web.py uses is not going to work. What Heroku does is it defines a port as an environment variable. Here you have 2 options you can bind a port in your app.run() method or you can add the port to your Procfile. Here is my updated Procfile:

web: python service.py $PATH

I chose to add the port to my Procfile but either option will work just fine. So here is the app.run() method

# Run the application on the Environment Port if one exists otherwise use port 8080
port = int(os.environ.get('PORT', 8080))
app.run(host='0.0.0.0', port=port)

Resources


  • It&#8217;s alive. Get the #regramapp on iTunes. http://regram.me

It’s alive. Get the #regramapp on iTunes. http://regram.me


After posting some questions online about setting up an OAuth connection for Instagram on an iOS App a few people asked me for help with how I implamented the integration. Here is a snipit of my code to hopefully help you all out.

static NSString *const authUrlString = @" https://api.instagram.com/oauth/authorize/ ";
static NSString *const tokenUrlString = @" https://api.instagram.com/oauth/access_token/ ";

// ADD YOUR CLIENT ID AND SECRET HERE
static NSString *const clientID = @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
static NSString *const clientSecret = @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

// YOU NEED A BAD URL HERE - THIS NEEDS TO MATCH YOUR URL SET UP FOR YOUR
// INSTAGRAM APP
static NSString *const redirectUri = @" http://mydomain.com/NeverGonnaFindMe/ ";

// CHANGE TO THE SCOPE YOU NEED ACCESS TO
static NSString *const scope = @"comments+relationships+likes";

@implementation OAuthLoginController
@synthesize webView = _webView;
@synthesize activityIndicator = _activityIndicator;

// GRAB THE URL TRAFFIC TO CATCH THE ACCESS TOKEN OUT OF THE RETURN URL
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSURL *Url = [request URL];
	NSArray *UrlParts = [Url pathComponents];
	if ([[UrlParts objectAtIndex:(1)] isEqualToString:@"NeverGonnaFindMe"]) {
		// CONVERT TO STRING AN CLEAN
		NSString *urlResources = [Url resourceSpecifier];
		urlResources = [urlResources stringByReplacingOccurrencesOfString:@"?" withString:@""];
		urlResources = [urlResources stringByReplacingOccurrencesOfString:@"#" withString:@""];
		
		// SEPORATE OUT THE URL ON THE /
		NSArray *urlResourcesArray = [urlResources componentsSeparatedByString:@"/"];
		
		// THE LAST OBJECT IN THE ARRAY
		NSString *urlParamaters = [urlResourcesArray objectAtIndex:([urlResourcesArray count]-1)];
		
		// SEPORATE OUT THE URL ON THE &
		NSArray *urlParamatersArray = [urlParamaters componentsSeparatedByString:@"&"];
		if([urlParamatersArray count] == 1) {
			NSString *keyValue = [urlParamatersArray objectAtIndex:(0)];
			NSArray *keyValueArray = [keyValue componentsSeparatedByString:@"="];
			
			if([[keyValueArray objectAtIndex:(0)] isEqualToString:@"access_token"]) {
				// THE TOKEN IS NOW IN [keyValueArray objectAtIndex:(1)]
				// YAY WE HAVE AN ACCESS TOKEN TO SAVE IN THE KEYCHAIN OR USER DEFAULTS
				// SWITCH STORYBOARDS INTO THE MAIN APP
				UIStoryboard *settingsStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
				UIViewController *initialSettingsVC = [settingsStoryboard instantiateInitialViewController];
				initialSettingsVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
				[self presentModalViewController:initialSettingsVC animated:YES];
			}
		} else {
			// THERE WAS AN ERROR
		}
		[self dismissModalViewControllerAnimated:YES];
		return NO;
	}
	
	return YES;
}

// ACTIVITY INDICATOR
- (void)webViewDidStartLoad:(UIWebView *)webView{
	[_activityIndicator startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
	[_activityIndicator stopAnimating];
}

// INITIATE THE VIEW WITH THE CORRECT URL
- (void)viewDidLoad {
	[super viewDidLoad];
		
	// Do any additional setup after loading the view.
	NSString *fullAuthUrlString = [[NSString alloc]
						initWithFormat:@"%@/?client_id=%@&redirect_uri=%@&scope=%@&response_type=token&display=touch",
						authUrlString,
						clientID,
						redirectUri,
						scope
						];
	NSURL *authUrl = [NSURL URLWithString:fullAuthUrlString];
	NSURLRequest *myRequest = [[NSURLRequest alloc] initWithURL:authUrl];
	[_webView loadRequest:myRequest];
}