Skip to content

Instantly share code, notes, and snippets.

export const mapsToken = 'Your Google Maps API token';
export const weatherToken = 'Your OpenWeatherMap API token';
export const fromPhoneNumber = 'Your Twilio phone number';
export const twilioSid = 'Your Twilio SID';
export const twilioToken = 'Your Twilio token';
@kasrak
kasrak / dedupe.js
Last active February 1, 2019 04:02
// Install lodash and airtable with npm or yarn
const _ = require('lodash');
const Airtable = require('airtable');
// Get API key and base ID from https://airtable.com/api
const base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('YOUR_BASE_ID');
// Fill in your table and field names.
const tableName = 'Table 1';
const emailField = 'Email';
@kasrak
kasrak / create_record.php
Last active June 15, 2021 14:20
Create a record in Airtable using PHP
<?php
$data = array(
"fields" => array(
"Name" => "Hello world"
)
);
$data_json = json_encode($data);
$ch = curl_init("https://api.airtable.com/v0/YOUR_BASE_ID/YOUR_TABLE_NAME?api_key=YOUR_API_KEY");
@kasrak
kasrak / gist:2bca5b265b16c477c14a
Created December 10, 2014 05:03
Swift: heterogenous generic items in an array
struct Box<T> {
let value: T
}
// This works:
let boxes1 = [Box(value: 42), Box(value: "hi")]
// This works:
let boxes2 = [Box(value: 42), Box(value: "hi")] as [Box<Any>]
@kasrak
kasrak / gist:2b79c458713cf77db632
Last active December 13, 2016 05:26
Swift: combining varargs and autoclosure
// This compiles:
func immediateOr(args:Bool...) -> Bool {
for arg in args {
if arg {
return true
}
}
return false
}