Skip to content

Instantly share code, notes, and snippets.

View scottsappen's full-sized avatar

Scott Sappenfield scottsappen

View GitHub Profile
@scottsappen
scottsappen / gist:81d1d36a50e38fdd71f9
Created June 24, 2015 01:36
Create a Stripe Managed Account...wow that is easy.
#Stripe platform key
stripe.api_key = pmsconstants._STRIPE_SECRET_KEY
#Create the Stripe managed account
stripeAccount = stripe.Account.create(
country='US',
managed=True,
email=member.emailaddress
)
@scottsappen
scottsappen / gist:6664689
Created September 22, 2013 23:00
Create a nice little effect using CSS. When hovering over an element, such as an icon for instance, you can move it up the screen by a few pixels slowly while changing its color. When you're done, reset it. Nice little touch.
//when hovering, change the cover and move the element up a few pixels
color: #9ed846;
transform: translate(0,-4px);
-webkit-transform: translate(0,-4px);
-o-transform: translate(0,-4px);
-moz-transform: translate(0,-4px);
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
@scottsappen
scottsappen / gist:6321545
Last active December 21, 2015 14:39
HTML5 video tag - I can't wait until every browser plays nice and supports it in full AND everyone upgrades to a recent version of said browser(s).
from google.appengine.ext.webapp import blobstore_handlers
blobstore.create_upload_url('some URL of yours')
class SubmitNewPropp(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
inputUploads = self.get_uploads()
inputUploadedHybridFile = inputUploads[0]
blobkey = str(inputUploadedHybridFile.key())
<video width="420" height="420">
@scottsappen
scottsappen / gist:6250208
Created August 16, 2013 14:02
Twitter tweet button needs head requests HTTP 200 OK to work
def head(self):
#this allows twitter callback to work
#https://dev.twitter.com/docs/tweet-button/faq#count-api-increment
return
$ curl -I http://www.proppitup.com
@scottsappen
scottsappen / gist:6091844
Created July 26, 2013 20:07
Grab 5 days of log data (today going backward) for application proppitup running remotely on Google App Engine
appcfg.py --oauth2 request_logs proppitup/ C:\Temp\mylogs.txt --num_days=5
@scottsappen
scottsappen / gist:6008368
Last active December 19, 2015 19:48
Large white activity animator inside UIView with greyed out background displayed in middle of screen. Could be included in an asynchronous NSURLConnection web call, for instance, and on the processing of the response, it could remove itself from its superview.
UIView *activityContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
activityContainer.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.25];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((self.view.frame.size.width/2) - 40, (self.view.frame.size.height/2) - 40, 80, 80)];
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
indicator.backgroundColor = [UIColor blackColor];
[indicator layer].cornerRadius = 8.0;
[indicator layer].masksToBounds = YES;
[indicator startAnimating];
[activityContainer addSubview:indicator];
[self.view addSubview:activityContainer];
@scottsappen
scottsappen / gist:5901921
Created July 1, 2013 15:36
Super simple Python web server. Netcat and various other utilities make it so easy to run a simple web server on your machine, but so does Python.
Here’s how you can run it on a Windows machine, but works quite well on Linux too (or Cygwin).
C:\>python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
@scottsappen
scottsappen / gist:5901913
Last active December 19, 2015 05:09
Programmatically calling a Segue in iOS
[self performSegueWithIdentifier:@"SegueHomeToOwnerDetail" sender:self];
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"SegueHomeToOwnerDetail"]) {
NSLog(@"prepareForSegue called for SegueHomeToOwnerDetail");
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
OwnerViewController *ownerViewController = [segue destinationViewController];
ownerViewController.myObject = [_activeArray objectAtIndex:selectedRowIndex.row];
} else {
NSLog(@"prepareForSegue called for SegueHomeToParticipantDetail");
@scottsappen
scottsappen / gist:5901906
Last active December 19, 2015 05:09
Rounded corners with Quartz in iOS
#import "QuartzCore/QuartzCore.h"
// Round corners using CALayer property
[[_aboutWebView layer] setCornerRadius:10];
[_aboutWebView setClipsToBounds:YES];
// Create colored border using CALayer property
[[_aboutWebView layer] setBorderColor:
[[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]];
[[_aboutWebView layer] setBorderWidth:2.75];
@scottsappen
scottsappen / gist:5901902
Last active December 19, 2015 05:09
Simple URL connection in iOS
NSString *urlAddress = @"http your url goes here";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[_aboutWebView loadRequest:requestObj];