Skip to content

Instantly share code, notes, and snippets.

View madewulf's full-sized avatar
🤷‍♂️
Multitasking.

Martin De Wulf madewulf

🤷‍♂️
Multitasking.
View GitHub Profile
@madewulf
madewulf / gist:def19e6f3a2c2836318e
Last active August 29, 2015 14:19
Listing available fonts on iOS.
for (NSString * familyName in [UIFont familyNames])
{
NSLog(@"---------------- %@ ---------------", familyName);
for (NSString * fontName in [UIFont fontNamesForFamilyName:familyName])
{
NSLog(@"- %@", fontName);
}
}
@madewulf
madewulf / gist:4ebec292b77db3dd4e3a
Created July 12, 2015 19:18
IAP receipt on device verification
- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchased:
{
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
NSDictionary *requestContents = @{
@madewulf
madewulf / fbbot.py
Last active April 18, 2016 08:30
A POC Python echo bot over FB messenger API using Flask and Requests
from flask import Flask
from flask import request
import json
import requests
PAGE_ACCESS_TOKEN = ""
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def bot():
@madewulf
madewulf / link.md
Created July 25, 2016 12:45 — forked from Spaxe/link.md
@madewulf
madewulf / TabComponent.swift
Created August 7, 2016 19:46 — forked from irace/TabComponent.swift
Easily roll your own `UITabBarController` alternatives. Here’s all the logic you need without assuming anything about your UI.
/**
* A class that can be part of a tabbed navigational interface (expected to be a `UIViewController` but can also be a
* coordinator that proxies through to an underlying controller).
*/
public protocol TabComponent {
/// The tab metadata
var tabItem: TabItem { get }
var viewController: UIViewController { get }
}
@madewulf
madewulf / salesforce.py
Created May 18, 2017 13:32
Python Flask and the Force.com REST API: Simple simple-salesforce example
from flask import Flask, redirect, request
import requests
from simple_salesforce import Salesforce
consumer_key = 'your_consumer_key'
consumer_secret = 'your_consumer_secret'
access_token_url = 'https://login.salesforce.com/services/oauth2/token'
redirect_uri = 'http://localhost:5000/callback'
authorize_url = 'https://login.salesforce.com/services/oauth2/authorize'
var rep = 20; // Number of repeat
var timeout = 370; // Delay between clicks
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function run() {
while (rep-- > 0) {$("#next_button").click(); await sleep(timeout);};
}
@madewulf
madewulf / index.html
Created September 4, 2017 11:03
Britecharts minimal example
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/britecharts@2/dist/bundled/britecharts.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.10.2/d3.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/britecharts.min.css"/>
</head>
<body>
<h1>Britecharts test</h1>
<div class="js-bar-container"></div>
@madewulf
madewulf / Makefile
Created October 25, 2017 15:05 — forked from johan/Makefile
Makefile of the steps in Mike Bostock's command-line cartography tutorial, parts 1-4 https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c
# request one at http://api.census.gov/data/key_signup.html and paste it below
CENSUS_API_KEY=YOUR_CODE_HERE
# a factor 1609.34 squared
SQ_M_TO_SQ_MI=2589975.2356
#prereqs:
# npm install -g shapefile # 0.6.1
# npm install -g d3-geo-projection # 1.2.1
# npm install -g ndjson-cli # 0.3.0
@madewulf
madewulf / gist:6844cef0d23f0a895051472e71355102
Last active October 7, 2020 12:40
Set performance test (less than 10 seconds on my Mac)
from uuid import uuid4
s = set()
for i in range (500000):
s.add(str(uuid4()))
count = 0
for uu in s:
if uu in s:
count += 1