Skip to content

Instantly share code, notes, and snippets.

View Un3qual's full-sized avatar

Ryan Un3qual

View GitHub Profile
import React from 'react'
import { Dimensions, Animated, View, Easing, Platform } from 'react-native'
import PropTypes from 'prop-types'
/**
* DismissableScrollview
* Will dismiss element when the user scrolls from the top and there is no more vertical
* scrolling available.
*/
export default class DismissableScrollview extends React.Component {
@dplummer
dplummer / resolver.ex
Created October 5, 2016 17:27
recursive batch resolver for Absinthe
defmodule Grav.Resolver do
def resolve(protocol_module, args, field) do
{:ok, %{meta: meta} = root} = apply(protocol_module, :where, [args])
records_name = root |> Map.keys |> Enum.reject(& &1 in [:meta, :links, :linked]) |> hd
records = preload_associations(root[records_name], field |> derive_preloads)
{:ok, root |> Map.put(records_name, records) |> Map.merge(meta)}
end
@mgcm
mgcm / instagram.json
Created August 25, 2015 12:27
Instagram JSON Sample
{
"meta": {
"code": 200
},
"data": [
{
"attribution": null,
"tags": [],
"type": "image",
"location": null,
@RafalFilipek
RafalFilipek / list
Created August 18, 2015 13:14
Facebook modules
facebook.com => console => Obect.keys(require.__debug.modules).join('\n')
module
exports
define
global
require
requireDynamic
requireLazy
requireWeak
@mprymek
mprymek / gist:8379066
Last active July 22, 2022 09:18
Elixir metaprogramming example
# This is an example of metaprogramming in the Elixir language.
#
# We will define a domain specific language (DSL) for the definition
# of a service which is watched by several sensors.
# Each sensor watches some property/functionality of the service and
# returns the result of the check.
#
# To determine if the service is functioning properly, we need functions
# to run all the sensors' code and gather the returned data.
#
@jpetazzo
jpetazzo / README.md
Last active December 13, 2024 03:44
Manual custom geocoding using OSM database

Someone asked how to get the latlong from a specific road near a town on OpenStreetMap.

If you need to do it only once (e.g., you're about to go on a trip, and your GPS cannot find your destination city, but allows you to enter GPS coordinates), you can use Nominatim, OpenStreetMap's geocoding interface.

If you need to do it multiple times, in a programmatic manner, there are at least two ways to do that.

Note: I worked with OSM data a couple of years ago, but I don't have an OSM database on my local laptop right now, so some instructions will be a bit fuzzy. I do apologize in advance.

PostGIS queries on a local OSM DB