Skip to content

Instantly share code, notes, and snippets.

View danielbuechele's full-sized avatar

Daniel Büchele danielbuechele

View GitHub Profile
@danielbuechele
danielbuechele / scriptable.js
Last active October 27, 2020 19:30
Covid Widget
if (!config.runsInWidget) {
return;
}
const url = `https://api.coronavirus.data.gov.uk/v1/data?filters=areaName=United%2520Kingdom;areaType=overview&structure=%7B%22date%22:%22date%22,%22value%22:%22newCasesByPublishDate%22%7D`;
const req = new Request(url);
const res = await req.loadJSON();
const chart = {
type: "line",
import { print as printGraphQL } from 'graphql-tag/printer';
import RecursiveIterator from 'recursive-iterator';
import objectPath from 'object-path';
export function createNetworkInterface(url) {
return {
query(request) {
const formData = new FormData();
// search for File objects on the request and set it as formData
@danielbuechele
danielbuechele / dbe2json.js
Created May 27, 2016 13:05
Convert DIGAS .DBE filte to JSON
var fs = require('fs');
const keyRegex = /(\[[A-Z\/#0-9]+\])/;
if (process.argv.length < 3) {
console.error('No file name given.');
process.exit(1);
} else {
parse(process.argv[2]).then(o => {
console.log(o);
});
@danielbuechele
danielbuechele / gist:b0c0b605be68736e1a28
Last active August 29, 2015 14:20
Flying Lufthansa you can access a flight information JSON-API via their on-board WiFi at http://map.boardconnect.aero/api/flightdata
{
"lon": 6.894092559814453,
"lat": 50.272064208984375,
"groundSpeed": 499.7942175120898,
"heading": 108.9605,
"orig": {
"lon": -0.461389,
"lat": 51.4775,
"code": "LHR"
},
@danielbuechele
danielbuechele / gist:36cf91edf3ea0da6a4a6
Last active August 29, 2015 14:17
HTML encode emojis
NSString *text = @"😀abc🇯🇵";
NSMutableString *convertedText = @"".mutableCopy;
[text enumerateSubstringsInRange:NSMakeRange(0,[text length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
unsigned int i = (unsigned int)*(const UInt32 *)[[substring dataUsingEncoding:NSUTF8StringEncoding] bytes];
if (i > 8436960) {
NSData *data = [substring dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSString *str = [NSString stringWithFormat:@"%@",data];
@danielbuechele
danielbuechele / gist:df0d17b6840e1513bfbc
Created March 21, 2015 12:46
Converting Emoji String to HTML and back
// Playground - noun: a place where people can play
import UIKit
let str = "Test 🇯🇵"
var str2 = ""
for char in str.unicodeScalars {
if (char.value>7936) {
str2 += "&#"+String(Int(char.value))+";"
@danielbuechele
danielbuechele / userscript.js
Last active June 13, 2017 18:53
Fluidapp Userstyle for Facebook Messenger
window.fluid.dockBadge = '';
var notify = true;
setInterval(updateDockBadge, 500);
function updateDockBadge() {
var count = document.querySelector(".pls._1r.fwn:not(.hidden_elem)");
if (count) {
if (notify) {
var title = document.querySelector('._kx ._l2 ._l1').textContent;
var text = document.querySelector('._kx ._l3').textContent;
@danielbuechele
danielbuechele / style.css
Last active August 29, 2015 14:02
Bootstrap screen sizes
@media (max-width:767px) {}
@media (min-width:768px) and (max-width:991px) {}
@media (min-width:992px) and (max-width:1199px) {}
@media (min-width:1200px) {}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {}
choc ~/.bash_profile
alias server="python -m SimpleHTTPServer 8000"
@danielbuechele
danielbuechele / gist:3817731
Created October 2, 2012 09:22
Sign Apple Passbook manifest.json
openssl smime -binary -sign -signer ./cert.pem -inkey ./key.pem -in ./manifest.json -out ./signature -outform DER