Skip to content

Instantly share code, notes, and snippets.

@jjhageman
jjhageman / item_image.rb
Created June 3, 2011 20:59
Extracting Geolocation Image Data with Carrierwave and RMagick on Heroku
class ItemImage < ActiveRecord::Base
belongs_to :item
mount_uploader :image, ImageUploader
before_save :extract_geolocation
def extract_geolocation
img = Magick::Image.read(image)[0] rescue nil
@mbostock
mbostock / .block
Last active April 28, 2022 21:44 — forked from mbostock/.block
Sticky Force Layout
license: gpl-3.0
@polotek
polotek / ember_hurdles.md
Last active March 30, 2017 05:37
Hurdles getting started with Ember.js

This is a brain dump of my experience trying to get something going with Ember.js. My goal was to get to know the ins and outs of the framework by completing a pretty well defined task that I had lots of domain knowledge about. In this case reproducing a simple Yammer feed. As of this time, I have not been able to complete that task. So this is a subjective rundown of the things I think make it difficult to get a handle on Ember. NOTE: My comments are addressing the Ember team and giving suggestions on what they could do to improve the situation.

App setup

The new guides have pretty good explanation of the various parts of the framework; routers, models, templates, views. But it's not clear how they all get strapped together to make something that works. There are snippets of examples all over the place like:

App.Router.map(function() {
  match('/home').to('home');
});
@alexdiliberto
alexdiliberto / ember-list-all-routes.js
Last active April 21, 2023 08:59
List all Ember route paths. (Just paste this in the console of your favorite Ember app)
// NOTE: `AppName` is simply your PascalCase application name (`modulePrefix` key from `../config/environment.js`)
window.AppName.__container__.lookup('service:router')._router._routerMicrolib.recognizer.names;
@benbalter
benbalter / transparency-is-so-08.md
Last active August 29, 2015 14:02
Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov (Notes from Transparency Camp 2014, http://transparencycamp.org/schedule/2014/transparency-is-so-08-why-treating-data-as-code-co/)

Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov

Question: Open government is a great first step, but how can we push towards collaborative government, the world's largest and longest-running open source project

Background

  • What differentiates open source from transparency is collaboration: the essential promise that you can see the underlying source code and make things better.
  • PDF of excel spreadsheets are technically transparency, but that's really not good enough.
  • A central promise of open source is not just to see the process, but participate and be able to modify source
  • Nothing -> FOIA -> Open Gov -> (Collaborative Gov?)
@YKCzoli
YKCzoli / Lidar_walkthrough.md
Last active November 15, 2023 18:35
Lidar_walkthrough

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele

@emeeks
emeeks / d3.sankey.js
Last active December 31, 2021 13:45
Sankey Particles
d3.sankey = function() {
var sankey = {},
nodeWidth = 24,
nodePadding = 8,
size = [1, 1],
nodes = [],
links = [];
sankey.nodeWidth = function(_) {
if (!arguments.length) return nodeWidth;
@vasanthk
vasanthk / System Design.md
Last active May 3, 2024 07:46
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@dannguyen
dannguyen / README.md
Last active December 28, 2023 15:21
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@maxvt
maxvt / infra-secret-management-overview.md
Last active February 28, 2024 20:53
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.