Skip to content

Instantly share code, notes, and snippets.

@aleks-mariusz
aleks-mariusz / osmaps-mobac.py
Last active March 18, 2017 18:04
this will download the geojson for ordinance survey's maps, parse it and create mobac-profiles for their explorer/landranger series of maps
#!/usr/bin/env python
import argparse
import itertools
import json
import math
import os
import re
import sys
import urllib2
@aesqe
aesqe / index.html
Created May 22, 2016 10:39
Load GL when possible or fallback to raster tiles when browser does not support webgl
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A simple map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Mapbox.js -->
<script src='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' />
@chrisroos
chrisroos / README.md
Created April 19, 2016 05:31
Differences between assert/refute and assert_equal true/false

Exploring the differences between the use of assert / refute versus assert_equal true / assert_equal false.

require 'dry-types'
class Carrier
attr_reader :name
def initialize(attributes)
@name = attributes.fetch(:name)
end
end
@pablobm
pablobm / README.md
Last active June 3, 2022 10:07
A clear convention for a CRUD with standard Ember + Ember Data

CRUD with Ember (+ Data)

Compatible with Ember 1.13.0+ Compatible with Ember Data 1.13.0+

Ember's official documentation describes a number of low-level APIs, but doesn't talk much about how to put them together. As a result, a simple task such as creating a simple CRUD application is not obvious to a newcomer.

@mkllnk
mkllnk / pre-commit
Last active April 1, 2016 04:49
Git pre-commit hook for Rubocop offenses
#!/bin/sh
# This script only checks the total number of offenses in modified files.
# If you removed old offenses, it may not warn you about new ones.
# Other scripts check all modified files for offenses.
# They don't ignore old offenses.
NUMBER_BEFORE=`git diff --cached --diff-filter=CMRTUXB --name-only -- '*.rb' | sed 's/^\(.*\)$/HEAD:\1/' | xargs git show | rubocop -s head -f o | tail -n 2 | head -n 1 | cut -d ' ' -f 1`
NUMBER_NOW=`git diff --cached --diff-filter=ACMRTUXB --name-only -- '*.rb' | xargs cat | rubocop -s now -f o | tail -n 2 | head -n 1 | cut -d ' ' -f 1`
@glaszig
glaszig / application.rb
Created March 10, 2016 11:57
Grouped table index for ActiveAdmin
# config/application.rb
module MyApp
class Application < Rails::Application
config.autoload_paths << config.root.join('lib')
end
end
@jexp
jexp / graph_gist_template.adoc
Last active February 22, 2024 17:29 — forked from cheerfulstoic/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction

@charlesrt
charlesrt / example.png
Last active October 18, 2024 06:36
Job Posting Standard
example.png
@pvcarrera
pvcarrera / sample_data.rake
Last active October 11, 2023 00:56
Load Rails fixtures ignoring PostgreSQL constraints
namespace :db do
desc 'Reset and populate sample data'
task populate_sample_data: [:reset, :drop_constraints, 'fixtures:load', :create_constraints] do
puts 'Fixtures loaded in the database'
end
desc 'Remove all database constraints'
task drop_constraints: [:environment, :create_constraints_script, :drop_constraints_script] do
ActiveRecord::Base.connection.execute(IO.read('tmp/drop_constraints.sql'))
puts 'Constraints dropped'