Skip to content

Instantly share code, notes, and snippets.

// https://twitter.com/skabber/status/449702060049457153
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
struct card {
int rank;
std::string suit;
} c = {3, "clubs"};
@skabber
skabber / gist:d1ff80669f86c5f5f378
Last active August 29, 2015 14:06
Push registration
- (void)updateAlerts
{
BOOL alertsMaster = [[NSUserDefaults standardUserDefaults] boolForKey:kAlertsMasterSwitch];
BOOL alertsSounds = [[NSUserDefaults standardUserDefaults] boolForKey:kAlertsSoundSwitch];
BOOL alertsBadge = [[NSUserDefaults standardUserDefaults] boolForKey:kAlertsBadgeSwitch];
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationType alert = UIUserNotificationTypeNone;
UIUserNotificationType sound = UIUserNotificationTypeNone;
UIUserNotificationType badge = UIUserNotificationTypeNone;

Keybase proof

I hereby claim:

  • I am skabber on github.
  • I am skabber (https://keybase.io/skabber) on keybase.
  • I have a public key whose fingerprint is B43A 137A 0E27 9DA4 E4C2 506C B531 E5F8 7D5A 42D9

To claim this, I am signing this object:

xcodebuild -scheme ${SCHEME} -target ${TARGET} -configuration ${CONFIGURATION} archive -archivePath $PWD/${TARGET}_${CONFIGURATION}_${BUILD_NUMBER}
xcrun -v -sdk iphoneos PackageApplication -v `pwd`'/'${TARGET}'_'${CONFIGURATION}'_'${BUILD_NUMBER}'.xcarchive/Products/Applications/'${TARGET}'.app' -o `pwd`'/'${TARGET}'_'${CONFIGURATION}'_'${BUILD_NUMBER}'.ipa'
try:
import cPickle as pickle
except ImportError:
import pickle
from couchdb import client
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase):
# Just a reminder to myself of how to write a decorator class for Django urls.
from functools import update_wrapper
from django.http import Http404
class IsGet(object):
def __call__(self, fn):
def decorate(request, *args, **kwargs):
return self.view_wrapper(request, fn, *args, **kwargs)
update_wrapper(self, fn)
// URL scheme: http://gist.github.com/*
// API endpoint: http://gist.github.com/services/oembed/
// Example call: http://gist.github.com/services/oembed/?url=http%3A//gist.github.com/54099
{
"version": "1.0",
"type": "rich",
"width": 400,
"height": 300,
"title": "oembed gist",
<div id="postbody">
<div style="float:left;padding-right:5px;">
<a href="{% url profiles.views.profile post.sender.username %}"><b>{{ post.sender }}</b></a>:
</div>
<div style="vertical-align:text-top;">
{{ post.text|oembed|urlize|fmt_post|safe }}
</div>
{% if post.image %}
<img src="{% thumbnail post.image 400x400 %}"/><br>
{% endif %}
# install virtualenv virtualenvwrapper into the global python path
easy_install virtualenv
easy_install virtualenvwrapper
# add these 2 lines to you bash_rc file
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/bin/virtualenvwrapper_bashrc
mkdir $HOME/.virtualenvs
# create the pinax virtualenv
+(UIImage *)makeRoundCornerImage : (UIImage*) img : (int) cornerWidth : (int) cornerHeight
{
UIImage * newImage = nil;
if( nil != img)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int w = img.size.width;
int h = img.size.height;