Skip to content

Instantly share code, notes, and snippets.

@bamnet
bamnet / .gitlab-ci.yml
Last active January 11, 2023 06:16
Multiarch Go Builds
image: docker:latest
services:
- docker:dind
stages:
- build
variables:
IMAGE: registry.gitlab.com/bamnet/njtdata
DOCKER_CLI_EXPERIMENTAL: enabled
@bamnet
bamnet / README.md
Last active October 20, 2018 04:52
Helper functions for use with the Google Maps JavaScript API to find points along a polyline.

Point Along Polyline

The percentAlongPath and distanceAlongPath functions below use the Geometry library of the Google Maps API to interpolate points a percentage or distance along a polyline. This can be useful to plot points along a polyline at regular intervals.

Note: The Geometry library must be loaded by appending &libraries=geometry to the <script> tag used to load the Google Maps API. For more information, check out the Library documentation.

analytics

<style id="jsbin-css">
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
{
"html_attributions" : [],
"results" : [
{
"formatted_address" : "101 Plaza Center, Secaucus, NJ 07094, United States",
"geometry" : {
"location" : {
"lat" : 40.79164149999999,
"lng" : -74.0568873
},
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "Ei02NS05OSBQYXVsIEFtaWNvIFdheSwgU2VjYXVjdXMsIE5KIDA3MDk0LCBVU0E",
"types" : [ "street_address" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJFziVmP33wokRRu0dx8XBfUE",
<VirtualHost *:80>
ServerName istaylorswiftsingle.com
DocumentRoot /var/www/istaylorswiftsingle
<Directory /var/www/istaylorswiftsingle>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
# Get level name of a membership
def level_name
name = (Membership::LEVELS.respond_to?(:key) ? Membership::LEVELS.key(level) : Membership::LEVELS.index(level))
name.to_s.humanize
end
@bamnet
bamnet / merge.js
Created November 9, 2011 05:32
Merge objects with combined keys
// Each table is an array [] of objects.
// Object MUST have all keys.
// Objects with matching keys will be merged into one object.
function merge(table1, table2){
keys = ['key', 'note'];
var merged = table1;
for(i in merged){
var obj1 = merged[i];
for(j in table2){
var obj2 = table2[j];
$("#ul.checkboxlist").find("input[type='checkbox']").live('click', function(){
// something to update the invoice here
console.log($(this).val()); //Should have the value of the checkbox that was clicked
});
icons = Hash.new
@vehicles.each do |v|
if !v.latest_position.nil?
icon = v.icon_id || 0
heading = v.latest_position.heading
if icons.has_key?(icon)
if icons[icon].has_key?(heading)
icons[icon][heading].push(v)
else
icons[icon][heading] = [v]