Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andrewxhill's full-sized avatar

Andrew W. Hill andrewxhill

View GitHub Profile
@andrewxhill
andrewxhill / AXH_Vector_Sum.sql
Created January 23, 2012 22:01
Sum PostgreSQL arrays in place [1,2,3] + [2,3,4] = [3,5,7]
CREATE AGGREGATE vector_sum (
sfunc = AXH_Vector_Sum,
basetype = int[],
stype = int[],
initcond = '{0}'
);
DROP FUNCTION IF EXISTS AXH_Vector_Sum(int[], int[]);
CREATE OR REPLACE FUNCTION AXH_Vector_Sum(int[], int[])
RETURNS int[] AS $$

On chatting to people

Chat is not the same as conversation. When you tag someone using the "@" or if you send them a direct message, you may be directly forcing them to change their focus to your problem. While this is good for you, it can be bad for a healthy and productive community. Here are a couple of rules to abide.

  • Only "@" tag people's names in the following cases.
    • Your comment is urgent/time-sensitive and you need the help of the "@" target. What is urgent? You are running a production application with 100s of users facing a broken API, it's urgent. You are experimenting or taking part in a competition and want an answer quickly, it's not urgent.
    • Your comment has grown stale and you still need an answer that the "@" target can provide. What is stale? In most cases, more than 2 days seems reasonable or if it's a weekend, 3 or more.
    • You comment is in a channel or thread where the "@" target is not present but you need them aware.
  • Abide by the "no hello" rule at all times. Provide
@andrewxhill
andrewxhill / README.md
Last active September 18, 2020 18:53
How to fully customize infowindows in CartoDB

Advanced Infowindow Design

Getting Started

In this section, we will show you the advanced methods for controlling infowindows styles using the CartoDB interface. These skills will allow you to have highly customized infowindows for your published maps, created directly on your account. You don't need any programming skills to edit infowindows and you can see a tutorial of basic methods here. This section is about advanced methods and you will be required to use basic skills in HTML and later CSS.

Editing Infowindow HTML

CartoDB gives you direct access to the HTML that controls the layout of your infowindows. If you don't feel ready to edit HTML and CSS see the tutorial of basic methods. In CartoDB you can find the advanced editor by selecting the Infowindow Wizard and then clicking the small code tag in the upper right.

@andrewxhill
andrewxhill / cdb_latlng.sql
Created April 28, 2014 18:50
cdb_latlng
--
-- Create a valid GEOMETRY in 4326 from a lat/lng pair
--
-- @param lat A numeric latitude value.
--
-- @param lng A numeric longitude value.
--
--
CREATE OR REPLACE FUNCTION CDB_LatLng (lat NUMERIC, lng NUMERIC) RETURNS geometry as $$
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta name="description" content="Template cloned from https://github.com/erengy/under-construction.">
<title>textile.io</title>
<style type="text/css">
html, body {
height: 100%;
/**
* Buckets
*
* You can now create Buckets for your User.
* Bucket contain raw files and documents.
*/
const buckets = new Buckets(db.context);
const roots = await buckets.list();

Powergate Show & Tell

Objective:

Create drop-in Filecoin API Management tools for systems and apps.

Key components:

  • Reputation Indices: A collection of data collected from the network for miner selection. Includes miner activity duration, slashing events, and deals.
@andrewxhill
andrewxhill / index.html
Last active September 13, 2019 10:14
Williams Transco leak history
<!doctype><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Odyssey.js Slides</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="http://cartodb.github.io/odyssey.js/sandbox/favicon.png">
<link rel="icon" type="image/png" href="http://cartodb.github.io/odyssey.js/sandbox/favicon.png">

Setup a new game of cmd-line tag!

Create a new game

sh new-game.sh

sh new-game.sh "Game 1"
@andrewxhill
andrewxhill / cloudflare-ipfs-update.sh
Created April 21, 2019 18:42
Update an IPFS record in Cloudflare DNS
#!/bin/bash
set -e # abort on any error
HASH=${1?param missing - hash.}
echo "Hi $PAGES_CLOUDFLARE_EMAIL"
if [[ -z "${PAGES_CLOUDFLARE_API_KEY}" ]]; then
echo "See setup instructions to set PAGES_CLOUDFLARE_API_KEY"
exit 1
fi