Skip to content

Instantly share code, notes, and snippets.

View halfdan's full-sized avatar
🇩🇪

Fabian Becker halfdan

🇩🇪
View GitHub Profile
defmodule SchemaChecker do
def find_field_discrepancies do
schema_modules()
|> Enum.map(fn mod ->
{mod.__schema__(:source), check_module(mod)}
end)
end
defp schema_modules do
{:ok, modules} = :application.get_key(:core, :modules)
@halfdan
halfdan / noise.jl
Created April 23, 2021 16:59
Noisy movement of 2D objects in Julia (Pluto.jl notebook)
### A Pluto.jl notebook ###
# v0.14.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
Plug 'itchyny/lightline.vim'
let g:lightline = {
\ 'colorscheme': 'challenger_deep',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'cocstatus', 'readonly', 'gitbranch', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'cocstatus': 'coc#status',
\ 'gitbranch': 'FugitiveHead',
import os, streams, parsecsv, options, json
type
Filter = object
column: string
`include`: bool
values: seq
min: Option[string]
max: Option[string]
@halfdan
halfdan / storage_proxy_bench.py
Created November 8, 2018 11:07
TinyDB Storage Proxy performance benchmark
from tinydb import TinyDB
from tinydb.database import Table, StorageProxy, Document
from tinydb.storages import MemoryStorage
from uuid import uuid4
class UUIDTable(Table):
def _init_last_id(self, data):
pass
@halfdan
halfdan / query.sql
Created October 6, 2017 08:51
Distance between two locations
SELECT
*,
ST_Distance(
"geom",
ST_Transform(
'0101000020E6100000E54350357A995EC0CA8745B181E34240', -- Value of a geom in the same table
2163
)
) AS "distance"
FROM "zoning_source_locations"
import Ember from 'ember';
export default Ember.Controller.extend({
value: '<h1>Demo header</h1>This is some <i>italic</i> text.'
});
{{#has tag="photo"}}
...post has the photo tag...
{{/has}}
{{#has tag="video"}}
...post has the video tag...
{{/has}}
{{#has tag="audio"}}
...post has the audio tag...
{{/has}}
{{^has tag="photo,video,audio"}}
import Ember from 'ember';
export default Ember.Component.extend({
string: null,
selection: "",
actions: {
selectionChanged(event) {
let target = event.target,
string = this.get('string');
% time GHOST_NODE_VERSION_CHECK=false npm install ghost
npm WARN engine ghost@0.7.5: wanted: {"node":"~0.10.0 || ~0.12.0 || ~4.2.0","iojs":"~1.2.0"} (current: {"node":"5.5.0","npm":"3.3.12"})
npm WARN engine ghost@0.7.5: wanted: {"node":"~0.10.0 || ~0.12.0 || ~4.2.0","iojs":"~1.2.0"} (current: {"node":"5.5.0","npm":"3.3.12"})
> ghost@0.7.5 preinstall /Users/halfdan/Projects/Ghost/test1/node_modules/.staging/ghost-0180c8c49224a758d7c7d6284f62b6e0
> npm install semver && node -e "require('./core/server/utils/startup-check.js').nodeVersion()"
ghost@0.7.5 /Users/halfdan/Projects/Ghost/test1/node_modules/.staging/ghost-0180c8c49224a758d7c7d6284f62b6e0
└── semver@5.0.3