Skip to content

Instantly share code, notes, and snippets.

View mbertrand's full-sized avatar

Matt Bertrand mbertrand

  • MIT Office of Digital Learning
  • Massachusetts
View GitHub Profile
@abelcallejo
abelcallejo / README.md
Last active October 29, 2024 01:29
Installing GDAL 3.2.1 on Amazon Linux 2

Installing GDAL 3.2.1 on Amazon Linux 2

gdal linux yum

As of this day, this is probably the only and fastest way of installing it.

Package requirements

Based from the GDAL and PROJ build requirements, here is the full list of required packages to install:

@rbarrois
rbarrois / wsgi.py
Created May 25, 2018 13:46
Django uWSGI warmup
# -*- coding: utf-8 -*-
import io
import os
import sys
import time
import wsgiref.util
import uwsgidecorators
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 19, 2024 11:06
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@cezarneaga
cezarneaga / filterArraysRamda.md
Last active April 26, 2023 07:52
Filter array of objects by nested values using ramda: Sometimes you dont have access to backend and you want to filter the response from an endpoint based on certain criteria. While trivial on flat arrays, this gets a bit tricky if the property you want to query is deeply nested. This is where Ramda shines.

Say we have a prop.users of the shape:

const users = [
    {username: 'bob', age: 30, tags: [{name: 'work', id: 1}, {name: 'boring', id: 2}]},
    {username: 'jim', age: 25, tags: [{name: 'home', id: 3}, {name: 'fun', id: 4}]},
    {username: 'jane', age: 30, tags: [{name: 'vacation', id: 5}, {name: 'fun', id: 4}]}
];
@zimmicz
zimmicz / server.js
Created August 6, 2017 16:25
PostGIS MVT Express routing
const express = require("express")
const app = express()
const { Pool } = require("pg")
const SphericalMercator = require("sphericalmercator")
const pool = new Pool({
host: "localhost",
port: 15432,
user: "postgres",
database: "postgres"
})
@mjohnsullivan
mjohnsullivan / generate_cloudfront_signed_cookies.py
Created January 1, 2017 16:34
Python script that generates signed cookies to control access to CloudFront content
#!/usr/bin/env python
"""
Copyright (C) 2017 Matt Sullivan
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
@qknow-w
qknow-w / react-videojs-es6.js
Created August 28, 2016 12:55
react-videojs-es6
import React, {Component} from "react";
import cx from 'classnames';
import vjs from 'video.js';
import _ from 'lodash';
import ReactDOM from 'react-dom';
const DEFAULT_HEIGHT = "100%";
const DEFAULT_WIDTH = "100%";
const DEFAULT_ASPECT_RATIO = (9 / 16);
const DEFAULT_ADJUSTED_SIZE = 0;
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@flibbertigibbet
flibbertigibbet / example.js
Created March 10, 2015 18:26
Example standalone Windshaft configuration
var Windshaft = require('./lib/windshaft');
var _ = require('underscore');
var tablename = 'YOUR TABLENAME HERE';
var style = '#' + tablename + ' { ' +
'line-color: #EFF3FF; ' +
'line-width: 2; ' +
'} ';
@insin
insin / mithril.html
Last active July 6, 2018 23:08
Templates for code snippets for various UI libraries in Stack Overflow answers (or anywhere else, really)
<meta charset="UTF-8">
<script src="https://npmcdn.com/[email protected]/mithril.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/MSXTransformer.js"></script>
<div id="app"></div>
<script type="text/msx;harmony=true">void function() { 'use strict';
var App = {
view(ctrl, attrs) {
return <h1>Hello {attrs.who}!</h1>
}