Skip to content

Instantly share code, notes, and snippets.

View jasperblues's full-sized avatar

Jasper Blues jasperblues

  • Earth (Mostly Australia & Philippines)
View GitHub Profile
package com.example.molecues;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier;
import org.springframework.boot.CommandLineRunner;
@tylermorganwall
tylermorganwall / humanity_globe.R
Created August 17, 2021 14:37
3D Humanity Globe
library(rayshader)
library(rayrender)
popdata = raster::raster("gpw_v4_population_density_rev11_2020_15_min.tif")
population_mat = rayshader:::flipud(raster_to_matrix(popdata))
above1 = population_mat > 1
above5 = population_mat > 5
above10 = population_mat > 10
@aa755
aa755 / gist:f7be3bf8116930fd935251a1650633ff
Last active July 6, 2021 16:26
Ivermectin factcheck rebuttal
moved to https://aa755.github.io/decoding-human-body/ivermectin/2021/07/05/ivmrebuttal.html
@jasperblues
jasperblues / SwiftUIAdapter
Last active December 23, 2020 02:50
Adapter allowing a UIKit controller to be backed by a SwiftUI view.
class SwiftUIAdapter<Content> where Content : View {
private(set) var view: Content!
weak private(set) var parent: UIViewController!
private(set) var uiView : WrappedView
var hostingController: UIHostingController<Content>
init(view: Content, parent: UIViewController) {
self.view = view
self.parent = parent
@blazewicz
blazewicz / pyenv-install.sh
Last active September 25, 2023 11:25
pyenv - Install Python 3.x with optimizations on macOS with macports
#!/bin/bash
set +x
PY_VERSION=3.10.1
export MAKE_OPTS="-j4"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --enable-framework"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --with-computed-gotos"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --with-system-expat"
@jexp
jexp / rdbms2graph.groovy
Created November 13, 2019 10:29
Transfer Data from an RDBMS via JDBC to any Neo4j DB
@GrabConfig( systemClassLoader=true )
@Grapes([
@Grab(group='org.postgresql', module='postgresql', version='42.0.0'),
@Grab(group='org.neo4j.driver', module='neo4j-java-driver', version='1.7.5')
])
import org.neo4j.driver.v1.*;
import java.sql.*;
Class.forName("org.postgresql.Driver");
@nicolas-miari
nicolas-miari / Array+ExportGif.swift
Last active August 29, 2019 16:06
Extension to Array<UIImage> to export the images as an animated gif.
import UIKit
import MobileCoreServices // needed for kUTTypeGIF
extension Array where Element == UIImage {
/**
Writes a looping animated gif to the documents folder, using the receiver's elements as the frames.
Based on [this answer](https://stackoverflow.com/a/46095888/433373) from Stack Overflow.
@michael-simons
michael-simons / Application.kt
Last active February 18, 2024 10:55
Minimal Kotlin/Gradle Example for Neo4j OGM
package so
import org.neo4j.ogm.annotation.GeneratedValue
import org.neo4j.ogm.annotation.Id
import org.neo4j.ogm.annotation.NodeEntity
import org.neo4j.ogm.annotation.Relationship
import org.neo4j.ogm.config.Configuration
import org.neo4j.ogm.session.SessionFactory
@NodeEntity
@VictorTaelin
VictorTaelin / promise_monad.md
Last active April 28, 2024 13:28
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@twilson63
twilson63 / README.md
Last active May 1, 2024 03:49
Cordova React Notes

Cordova Apps with React

React and OnsenUI work great for cordova apps, there are a couple things to keep in mind when working with Cordova Apps.

Relative Paths not Absolute Paths

Since Cordova Apps load from the file system they do not work great with absolute urls, they use relative urls, which means

<script src="/bundle.js"></script> will not work as you might expect when using a web server. Since the root file system of

device is not where the files are located. You can resolve this using a relative url.