Skip to content

Instantly share code, notes, and snippets.

View a75c6's full-sized avatar
💭
Eating tuna

[]\ a75c6

💭
Eating tuna
View GitHub Profile
@DougGregor
DougGregor / dynamic_member_lookup_environment.swift
Created May 2, 2018 16:59
Using Swift 4.2's @dynamicMemberLookup to expose environment variables
import Darwin
@dynamicMemberLookup
struct Environment {
subscript(dynamicMember name: String) -> String? {
get {
guard let value = getenv(name) else { return nil }
return String(validatingUTF8: value)
}
@r-kumakura
r-kumakura / gist:e99943ccdfb075d18358b68d60576fd4
Created November 22, 2017 05:18
Swift UUID (non hyphen)
// UUID
func createUUID() -> String {
let uuid = NSUUID().uuidString
return uuid.components(separatedBy: "-").joined()
}
struct Drinks: Decodable {
let drinks: [Drink]
enum DrinksKey: CodingKey {
case drinks
}
enum DrinkTypeKey: CodingKey {
case type
}
@skippy
skippy / edge-envoy.json
Last active November 18, 2017 23:52
failing ssl usage
{
"listeners": [
{
"address": "tcp://0.0.0.0:443",
"ssl_context": {
"cert_chain_file": "/etc/envoy/cert/cert.crt",
"private_key_file": "/etc/envoy/cert/cert.key",
"ca_cert_file": "/etc/envoy/cert/cert.ca"
},
"filters": [
let button = UIButton()
override init(frame: CGRect) {
super.init(frame: frame)
addSubview(button)
}
override func layoutSubviews() {
super.layoutSubviews()
button.frame = CGRect(15, 15, bounds.width - 30, 40)
@scottopolis
scottopolis / splice-object-array.js
Last active July 4, 2025 13:21
Remove object from array of objects in Javascript
// we have an array of objects, we want to remove one object using only the id property
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id of 37
const removeIndex = apps.findIndex( item => item.id === 37 );
// remove object
apps.splice( removeIndex, 1 );
@st3fan
st3fan / LocaleIdentifiers.txt
Created January 12, 2017 01:33
iOS Locale Identifiers
Locale identifiers for: iOS 10.2
af
af_NA
af_ZA
agq
agq_CM
ak
ak_GH
am
am_ET
@qwo
qwo / emoji.js
Last active May 17, 2017 09:22 — forked from beaugunderson/emoji.js
Scrape all emojis with descriptions from unicode.org/emoji/charts website
/*TODO Remove Tag when Done */
var request = require('request');
var cheerio = require('cheerio');
var fs = require('fs');
console.log('retrieving unicode table...');
request.get('http://unicode.org/emoji/charts/full-emoji-list.html', function (err, response, body) {
console.log('loading data...');
@tadija
tadija / FontNames-iOS-17.4.swift
Last active June 26, 2025 20:25
iOS - All Font Names
/*
*** Academy Engraved LET ***
AcademyEngravedLetPlain
---------------------
*** Al Nile ***
AlNile
AlNile-Bold
---------------------
*** American Typewriter ***
AmericanTypewriter
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software