This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def nums (take 100 (repeatedly (partial rand-int 10)))) | |
(->> nums | |
(map-indexed vector) | |
(partition-by second) | |
(map (juxt (comp second first) (partial map first))) | |
(map (fn [[num indexes]] | |
(let [bounds (distinct ((juxt first last) indexes))] | |
(str (clojure.string/join "-" bounds) ": " (apply str (repeat num "#")))))) | |
(run! println)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
from shapely.geometry import Polygon, MultiPolygon | |
gdf = gpd.read_file('zip://Regions_December_2022_EN_BUC-shapefile.zip') | |
# Convert to EPSG:4326 from OSGB36 | |
gdf = gdf.to_crs("EPSG:4326") | |
def correct_ring_orientation(geometry): | |
if isinstance(geometry, Polygon): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class CustomFormatter | |
RSpec::Core::Formatters.register self, :example_failed | |
def initialize(output) | |
@output = output | |
end | |
def example_failed(notification) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"userName": "DFE-Digital", | |
"repo": "apply-for-postgraduate-teacher-training" | |
}, | |
{ | |
"userName": "DFE-Digital", | |
"repo": "apply-for-postgraduate-teacher-training-prototype" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'open_api_parser' | |
gem 'pry' | |
gem 'json_schema' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I was moving a vanilla WP site to Bedrock but wanted to start | |
# working in Bedrock sooner, so I needed to backport commits | |
# from Bedrock to the old repo. Bedrock uses a different folder structure, so | |
# whereas my commits were in in web/app/themes/mytheme, the old | |
# repo needed changes in wp-content/themes/mytheme. | |
# In Bedrock | |
cd web/app/themes/mytheme | |
git format-patch --relative <commit-hash-at-branch-base> --stdout > ~/patches-from-bedrock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns bubble.core | |
(:require [d3 :as d3])) | |
(enable-console-print!) | |
(.format d3 "d") ; we will use integers for our data | |
; set up a color sequence. Later on we will pass numbers to the | |
; 'color' function defined here and it will give us back colours one | |
; by one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The object to be decorated | |
class Coffee { | |
price() { | |
return 10; | |
} | |
notify(message) { | |
console.log('coffee got a message: ' + message); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
session_start(); | |
use GuzzleHttp\Client; | |
use GuzzleHttp\HandlerStack; | |
use GuzzleHttp\Subscriber\Oauth\Oauth1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// could do with some DRYing up | |
/** | |
* Usage: | |
* | |
* $aftership = AfterShip::get_instance(); | |
* | |
* // get the tracking info (returns WP_Error with message on failure, JSON on success) |
NewerOlder