Stripe & Plaid Node Integration

If you are trying to get Stripe and Plaid to work for your ACH verification, I have a few pointers and some code you can checkout.

Tl;dr: https://github.com/Threde/stripe-plaid-ui
This code assumes you’ve already made your customer’s account on stripe’s back-end. And that you are passing the the param ‘customer’ in the hosted url.
ex: https:localhost.com/?customer=cus_ANjLfuBWFXthGb

Stripe & Plaid Documentation

When I had to build a payment portal for Threde, I discovered trying to hookup Plaid with Stripe wasn’t as simple as I might have thought. I truly thought it was as simple as getting the right keys and I would be good to go, but that’s not the case.

To start off, you want to obviously get a stripe and plaid account. On the plaid side, you will need to hook it up to your stripe account. After doing so, if you are like me ( a small startup), to get the plaid access, I suggest you email them directly to get in. We, at Threde, don’t do a lot of ACH transactions so it didn’t make sense for us to do a monthly payment thingy. So by emailing them and asking if they have something for us, they upgraded our account. Thanks Plaid! 😀

But yeah, after you get the keys, I discovered that the documentation wasn’t very straight forward on Plaid’s side. For Stripe, it wasn’t straight forward on how to get the right token for a transaction for Plaid. After hours of digging, I was finally able to figure out how to really hook the two up.

So, there are two parts to this that you need to do. You have to make an api that can talk to stripe & plaid api at the same time and you have to have the plaid-link with the correct version of stripe on the client-side.

for the server-side, code go here:
https://github.com/Threde/stripe-plaid-ui/blob/master/index.js

for the client-side code, go here:
https://github.com/Threde/stripe-plaid-ui/blob/master/views/index.ejs

( don’t judge, I know it’s shit but I haven’t had time to clean it)

here’s the step process:

  1. get customer’s id & info from the url param ‘customer’ and save that as a global on the server-side via /get_customer_info
  2. customer clicks on plaid-link and we send the plaid token to the server-side to get the bank access token via /get_access_token
  3. customer clicks on verify to verify the bank account to link to the ‘customer’ id on the server-side via /verify_bank
  4. customer adds the bank account via stripe’s client on the server-side.

The important thing about this process, that wasn’t mentioned clearly in the documentation in stripe or plaid, is that you have to use the plaid access token + account id to get the stripe bank account token….sounds confusing but in a gist, what I am trying to say is you use the plaid access token inside of plaid’s createProcessorToken(ACCESS_TOKEN, ACCOUNT_ID) to get the stripe bank account token for using stripe’s
stripe.customers.createSource(CUSTOMER_ID, { source: STRIPE_BANK_ACCOUNT_TOKEN})

The README file has links to all the docs. Also, I left comments with some links in the code to explain where to find the documentation for the different methods from Stripe and Plaid.

Anyhoo, if you have questions let me know.

 

Fuck Yeah! Front-end Development

Ok, so I started a joke blog after Nick Hudkins, from Bolster Labs, made a “Fuck Yeah!” suggestion. The idea started with me randomly starting to sing the “America, Fuck Yeah!” ( http://www.youtube.com/watch?v=3BN1jSpiyIM&feature ). Immediately after starting to sing the lyrics, all of the guys from Bolster Labs started singing it as well. Which then, Nick started to talk about all the “Fuck Yeah!” tumbler pages he has started and then told me to start fuck-yeah-front-end-development.

And so my journey of writing half bullshit web articles as a joke has started.

http://fuckyeahfrontenddevelopment.tumblr.com/

The Future of Responsive Design

The Future of Web: Responsive Design

Giving birth to an entirely new future for users using web

Responsive design aims to make web pages compatible with all devices—without relying on the creation of multiple layouts and styles. Because of the explosion of mobile and tablet devices, constructing multiple versions of a site for all possible users is no longer feasible.  Instead of device-specific versions, responsive design relies on flexible layouts, images, and cascading style sheet media queries. Its goal is to detect a user’s screen size and orientation, adjusting those flexible designs accordingly.

The fluidity of responsive design approach comes from a combination of strategies. Layouts are made flexible through proportion-based grids—and percentages, not fixed pixels or points, determine size. Likewise, images always fit properly on the page, since they are designed to display relative to their containing elements. Finally, cascading style sheets work in conjunction with media queries to determine how the page is being accessed and to render it optimally for that device.

Expect to see responsive design supersede traditional fixed approaches over the next few years. It’s a win for both user and site owner–enhancing user experience while cutting design and development costs. As web users become more and more accustomed to switching from laptop to tablet to smartphone, their expectations for seamless transitions between devices increase. Responsive design approaches offer that seamlessness, creating an optimized user experience. Web pages adjust automatically to any screen, without excessive panning, scrolling, and resizing.

This fluid approach to design also cuts costs significantly. Creating one universally adaptable website eliminates the need for a brand-new design and development process each time a tinier tablet, a bigger smartphone, or some other new gadget enters the market.

In June, 2012, Google recommended responsive design as the best configuration for rendering web pages appropriately on smartphones.  And for those with SEO concerns, the search giant made its preference clear: “[With responsive design] Google can discover your content more efficiently as we wouldn’t need to crawl a page with the different Googlebot user agents to retrieve and index all the content.”

Google’s recommendations are especially important given that sales of desktop and laptop computers are in decline across nearly all manufacturers. The last half of 2012 represented the worst PC sales since 2001—due to both poor economic conditions and consumers’ increasing reliance on cheaper gadgets for web access.

Indeed, according to the Mobile Marketing Association, mobile web access is expected to surpass PC access in 2013—beating a 2015 “mobile domination” prediction by Morgan Stanley analysts in 2010.

The exponential growth of mobile is redefining web design standards. Mobile users demand fluid display and easy navigation, and business owners and developers can no longer predict what size screens their sites will display on. The flexibility of responsive design makes it a universal approach; and, with Google’s blessing, it is quickly becoming the standard.

When to use Responsive Design

You should use responsive design initially and as often as possible. With the changes of mobile devices and how we interact with them on a daily basis, it’s critical to target a variety of viewports and resolutions. Making sure that your website or web application is cross platform (device) compatible is becoming more important over time and equally important as cross browser compatible. In other words responsive design is now mainstream.

“Google is now suggesting developers use responsive design tools like media queries to handle the variety of screens now accessing the web.” – http://googlewebmastercentral.blogspot.co.uk/2012/04/responsive-design-harnessing-power-of.html

Responsive Design in it’s early stages was mainly the practice of doing a one size fits all solution for everything, browser and platform alike. But if we just take the core concepts of responsive design, we can use it with other best practices to greater fit our need. Like, using a mobile site and creating a responsive design for that vs using it as a layer for the main site.

When initializing or integrating Responsive Design the following topics need to be thoroughly reviewed for the best solution:

The our considerations prior to implementation are:

  • Some content needs to be packed differently
  • Other content needs to be a smaller or less bulky
  • And what content do you leave behind

Our goals with implementing responsive design is to do the following:

  • Our purpose stays the same
  • Our strategy changes
  • The solution is a mix of what we already have plus some new things
  • The more we become familiar with the constraint, the better our solution

The Benefits with using responsive design:

Is Accessible in benefiting disabled users?
http://www.tsw-systemsolutions.com/blog/mobile-website-design/responsive-web-design-accessibility-using-all-web-channels/

Phonegap, Terminal, Android SDK beginner tutorial “hello world”

So due to the nature of trying to get going on phonegap and the lack of strait information out there, I thought I would do a quick write up on how to do the following:

  • Install android SDK on Mac
  • start an android project
  • put phonegap into your app.
  • do a “hello world”

( I am also doing this because I prefer to use Sublime Text vs Eclipse )

INSTALLING ANDROID SDK ON MAC

So the first thing we need to do is get the Android SDK.
http://developer.android.com/sdk/index.html

Now unzip it, open up your terminal and cd to the dir where you unzipped it. You will now have to mv it to your ( /usr/local/bin/ )

mv android-sdk-macosx/ /usr/local/bin/android-sdk-macosx

once moved, you will need to add it to your tools $PATH (aka .profile). This is typically located at (.) . So you can use whatever editor you want to add the line. I will show you how to do it with vim. cd so that you are in your home dir.

vim .profile

once in there press “i” , to edit, and add copy&paste the following line anywhere in the file on its own separate line.

export PATH=/usr/local/bin/android-sdk-macosx/platform-tools:/usr/local/bin/android-sdk-macosx/platforms:/usr/local/bin/android-sdk-macosx/tools:$PATH

now exit and save by hitting “escape” and typing

:wq

(wq means write and quit, in otherwords save and exit)

Now you should be able to use the android cmd.

you should be able to type in the following cmd which will open up the android SDK Manager:

android

now that the SDK manager is open, you will have to download and install the following that is checked in the check box. I am downloading the latest android version because I don’t really care about older versions in this tutorial.

Android SDK

Android SDK

once you are done downloading and installing all of that stuff we can get to the fun part of starting and android app!

STARTING AN ANDROID APP

So we are going to do this all though terminal, on command line. To create a new project, first goto the directory where you want your project. Make a new directory for your app and go into it

mkdir MyFirstApp

cd MyFirstApp

Now we have to see what versions of android you have that we should build this project on. Run the following cmd:

android list targets

you should now see what versions you have like the following. Take note of were it says ” id: “. The number that is being use will be used to target that platform. I will be using id: 1 because that is latest and the one I want to use for this tutorial. To build the project we will need to run the following cmd:

android create project –target 1 –name MyFirstApp –path . –activity MainActivity –package com.MyFirstApp

Here is the break down of the following cmd:

  • create project – cmd for creating a new project
  • target – which id number to use that corresponds with the android platform you want to use.
  • name – name of your project
  • path – the location where your files should be put/created. i used (.) because I was already in the directory.
  • activity – is the name of the app that is displayed
  • package – your package name has to be unique across all packages installed on the android system so the best practice is to use your organization as the entity. for this example we are using com.MyFirstApp

For more details go here:
http://developer.android.com/training/basics/firstapp/creating-project.html

Ok, so we have created a project. The next thing we will have to do is setup the emulator to test our app.

SETTING UP ANDROID EMULATOR

To do this all you need to do is run the following cmd:

android avd

Now create a new virtual android machine. >:D

For more details on this go here:
http://developer.android.com/training/basics/firstapp/running-app.html#Emulator

now that we have the emulator open and running, we will have to open a new terminal window and compile/install our app on to the virtual android machine.

RUN ANDROID APP

To run our app, we first have to compile and debug our app by running the following cmd:

ant debug

(apache ant is installed on all macs so this should work)

ant debug compiles and debugs your app in to your /bin dir. To install your app on to your vm you use the following cmd:

adb install -r bin/MyFirstApp-debug.apk

adb install -r , deletes/removes your app and reinstalls it on to your vm. So in a nutshell, those two cmd’s are the most important cmd’s you will need to know and remember. If this installs smoothly, you will see your app in the app’s section of your emulator. The app name should be “MainActivity“. Open it and you will see basic text.

( the file that the text is coming from is located at res/layout/main.xml )
For more information on android’s mvc file system go here:
http://developer.android.com/training/basics/firstapp/running-app.html

For more details go here:
http://developer.android.com/training/basics/firstapp/running-app.html

Assuming that everything has gone smoothly to this point. We can now get into the fun that Phonegap has to offer!

USING PHONEGAP WITH ANDROID SDK

We will now have to go and download phonegap:

http://phonegap.com/download/

Once downloaded and unzipped, we will have to put phonegap in place. Make a new directory called ” libs ” in the root of your directory and a the following “assets/www” .

mkdir libs

mkdir assets

mkdir assets/www

now that the new directories have been created, we can start putting phonegap in place.

move cordova-2.0.0.js to assets/www
move cordova-2.0.0.jar to libs/
copy the xml directory into res/

We will now have to edit some files to get everything else going.

Goto src/com/MyFirstApp/

and edit the MainActivity.java file

  • add import org.apache.cordova.*; after import android.os.Bundle;
  • Change Activity to DroidGap
  • Replace setContentView(R.layout.main); with super.loadUrl(“file:///android_asset/www/index.html”);

Goto bin/ and edit the AndroidManifest.xml

Add the following after the “manifest” tag.

<supports-screens
android:largeScreens=”true”
android:normalScreens=”true”
android:smallScreens=”true”
android:resizeable=”true”
android:anyDensity=”true” />

<uses-permission android:name=”android.permission.VIBRATE” />
<uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />
<uses-permission android:name=”android.permission.ACCESS_LOCATION_EXTRA_COMMANDS” />
<uses-permission android:name=”android.permission.READ_PHONE_STATE” />
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.RECEIVE_SMS” />
<uses-permission android:name=”android.permission.RECORD_AUDIO” />
<uses-permission android:name=”android.permission.MODIFY_AUDIO_SETTINGS” />
<uses-permission android:name=”android.permission.READ_CONTACTS” />
<uses-permission android:name=”android.permission.WRITE_CONTACTS” />
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
<uses-permission android:name=”android.permission.GET_ACCOUNTS” />
<uses-permission android:name=”android.permission.BROADCAST_STICKY” />

Our next step is to create the index.html file.

Goto assets/www and create index.html.

paste the following:

<!–DOCTYPE html>–>
<html>
<head>
<title>My First App</title>
// <!–[CDATA[–>
javascript” charset=”utf-8″ src=”cordova-2.0.0.js”>
// ]]>

</head>
<body>
<h1>Hello World This is my first app!</h1>
</body>
</html>

Now run:

ant debug

adb install -r bin/MyFirstApp-debug.apk

and test your app!

From here you can do all of your js, css and etc.

For more information go here:
http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

If you have any questions or would like to point out any of my mistakes, please leave a comment, thank you.

VMware, Localhost and django

Run ifconfig vmnet1 in Terminal to get the inet IP address.

My output looks like this:

vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:50:56:c0:00:01 
inet 192.168.249.1 netmask 0xffffff00 broadcast 192.168.249.255

So my inet IP address is: 192.168.249.1

Then, edit your hosts file in the Windows VMWare instance. This file lives here:
C:/WINDOWS/system32/drivers/etc/hosts


192.168.249.1 yourdomain.local
192.168.249.1 localhost

Afterwards, you need to flush your dns on the windows box.
In CMD type in ipconfig /flushdns

If you are running Django, when you do ./manage.py , target for that Ip.

./manage.py 192.168.249.1:8000

Accessible Tag Cloud

So based on my research with Tag Clouds I’ve decided to make semantic, accessible, and  Seo friendly Tag Cloud.

The Tag cloud structure is in an ordered list because its more semantic with the most relevant list item to the lest relevant list item. Because it’s in an ordered list this ordering is relevant and is relevant to search engines. Then the Javascript kicks in and re-orders and tabindex’s the items in the initial order they were listed in. On top of that, the Js adds in Wai-Aria info for screen readers. There is also visually hidden text as a descriptor for search engines and screen-readers alike.

https://github.com/michaelguild13/Accessible-Tag-Cloud

<ol class=” class=”tagcloud”>
<li><a href=”#”>Item 1</a></li>
<li><a href=”#”>Item 2</a></li>
<li>Item 3</li>
<li><a href=”#”>Item 4</a></li>
<li><a href=”#”>Item 5</a></li>
</ol>

<script type=”text/javascript”>
$(“.tagcloud”).tagcloud();
</script>