Skip to content

Instantly share code, notes, and snippets.

@b-per
b-per / dbt_cloud_api_vanilla_python.py
Last active March 19, 2024 16:55
Call dbt Cloud API to trigger jobs without having to install requests
from urllib.request import Request, urlopen
from urllib import parse
import os
import time
import json
#------------------------------------------------------------------------------
# get environment variables
#------------------------------------------------------------------------------
api_base = os.getenv('DBT_URL', 'https://cloud.getdbt.com/') # default to multitenant url
@simonkuhn
simonkuhn / geo.vcl
Last active January 7, 2022 12:16
Fastly VCL for geoip json output
sub vcl_recv {
#FASTLY recv
# We don't do other methods
if (req.method != "GET") {
return(error);
}
# Handle IPv4 or IPv6 provided in url path (nothing extraneous allowed, perform basic matching)
if (req.url.path ~ "^/([a-f0-9:.]+)$") {
set client.geo.ip_override = re.group.1;
@robertknight
robertknight / reviewing-dependency-updates.md
Last active February 3, 2020 20:42
How I review dependency updates

How I review dependency updates

These are some notes on my process when I review dependency updates for both JavaScript and Python projects at Hypothesis.

Before you add a dependency

Before adding a dependency to a project, consider the impact on future maintenance. If what the dependency does for the project can be implemented with only a few lines of code, or can be implemented in an alternative way using dependencies the project already has, it may be a better choice to do that and avoid the dependency.

Dependency update process

@RobertAKARobin
RobertAKARobin / python.md
Last active April 18, 2024 20:44
Python Is Not A Great Programming Language
@roustem
roustem / Setting-up-Windows-WSL1.md
Last active February 25, 2024 07:12
Setting-up-Windows-WSL1
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@yamanetoshi
yamanetoshi / XWalkViewExample.java
Created July 27, 2015 06:55
XWalkView Example
mWebView.setResourceClient(new XWalkResourceClient(mWebView) {
@Override
public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) {
WebResourceResponse ret = null;
try {
URL tmpUrl = new URL(url);
mConn = (HttpURLConnection)tmpUrl.openConnection();
mConn.addRequestProperty("Authorization", authHeader);
mConn.addRequestProperty(getString(R.string.app_version_header_key), ((MyApplication)getApplication()).getVersioName());
@marteinn
marteinn / info.md
Last active January 21, 2024 06:57
Using the Fetch Api with Django Rest Framework

Using the Fetch Api with Django Rest Framework

Server

First, make sure you use the SessionAuthentication in Django. Put this in your settings.py

# Django rest framework
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
 'rest_framework.authentication.SessionAuthentication'
@joakimbeng
joakimbeng / test_runner.js
Last active July 12, 2020 22:38
A small and simple Javascript test runner
/**
* A Javascript test runner in 20 lines of code
* From http://joakimbeng.eu01.aws.af.cm/a-javascript-test-runner-in-20-lines/
*/
(function () {
// The test queue:
var tests = [];
// Function to add tests:
this.test = function test (name, cb) {
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing