Skip to content

Instantly share code, notes, and snippets.

@bjoerge
bjoerge / ExternalDataInput.js
Created December 21, 2018 12:46
Example of a custom sanity input that allows the user to select from a list of values retrieved from an external API
import React from 'react'
import SearchableSelect from 'part:@sanity/components/selects/searchable'
import FormField from 'part:@sanity/components/formfields/default'
import {PatchEvent, set, unset} from 'part:@sanity/form-builder/patch-event'
const STREET_NAMES = [
'Thorvald Meyers gate',
'Champs-Élysées',
'Lombard Street',
'Abbey Road',
@HoraceBury
HoraceBury / debugconsole.lua
Last active January 29, 2019 13:38
Debug Print Console
-- debug console
local widget = require("widget")
local lib = {}
local originalPrintFunc = print
local debugPrintFunc = nil
local showingDebugConsole = false
@bobcgausa
bobcgausa / assetTest.json
Created September 8, 2014 22:18
Corona JSON Loader/Manager
{
"sheet_bat": {
"class": ",imagesheet,",
"path": "images/bat.png",
"options": {
"width": 32, "height": 48, "numFrames": 12,
"sheetContentWidth": 192, "sheetContentHeight": 96
}
},
"background_mountain": {
@bobcgausa
bobcgausa / Ellipse.lua
Created August 3, 2014 22:58
Lua Arcs and Ellipses
Ellipse = {
--declare constants
format='%d %d %d %d ',
class=',Ellipse,class,'
}
function Ellipse:tostring()
return string.format(self.format,self.x,self.y,self.width,self.height)
end --tostring
function Ellipse:new(centerX, centerY, wide, tall)
assert(wide>=0 and tall>=0)
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.