Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter W techieshark

View GitHub Profile
View code_fights_permutation.py
from itertools import permutations
a = ["aba", "bbb", "bab"]
b = ["ab", "bb", "aa"]
c = ["ab", "bb", "aa", "ab", "bb", "aa", "ab", "bb", "aa", "ab", "bb", "aa"]
def string_diff(x, y):
stuff = sum(1 for x, y in zip(x, y) if x != y)
return stuff
@spalladino
spalladino / monitor.js
Created Oct 15, 2017
Configure ngrok with nodemon for local development
View monitor.js
#!/usr/bin/env node
if (process.env.NODE_ENV === 'production') {
throw new Error("Do not use nodemon in production, run bin/www.js directly instead");
}
const nodemon = require('nodemon');
const ngrok = require('ngrok');
// We start an ngrok tunnel to ensure it stays the same for the entire process
@troyfontaine
troyfontaine / 1-setup.md
Last active May 13, 2021
Signing your Git Commits using GPG on MacOS Sierra/High Sierra
View 1-setup.md

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@jothirnadh
jothirnadh / overpass.md
Created Mar 10, 2016 — forked from planemad/overpass.md
Uploading OSM data to Mapbox using an overpass query
View overpass.md

If you have been playing around with the new Mapbox Studio you might be interested to know how to make a custom map with objects of your own interest from OpenStreetMap.

To make the process of creating an updating an OSM based dataset on Mapbox more seamless, I was looking into a command line based workflow that could extract OSM data from Overpass and update a Mapbox hosted dataset in one go.

Requirements

Generate an Overpass Query

  • Use Overpass Turbo to create a query for the data you are interested in extracting. Since i'm interested in bus stops, I first browse the map to Bengaluru, India and then generate a query using the wizard query highway=bus_stop
@scottmagdalein
scottmagdalein / clickable-element.html
Last active Jan 21, 2021
Make the Mailchimp Subscriber popup appear on click
View clickable-element.html
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
@bryangoodrich
bryangoodrich / TwitterTopics.r
Last active Nov 23, 2020
Twitter Topic Modeling Using R
View TwitterTopics.r
# Twitter Topic Modeling Using R
# Author: Bryan Goodrich
# Date Created: February 13, 2015
# Last Modified: April 3, 2015
#
# Use twitteR API to query Twitter, parse the search result, and
# perform a series of topic models for identifying potentially
# useful topics from your query content. This has applications for
# social media, research, or general curiosity
#
@iansltx
iansltx / _safari-iframe-cookie-workaround.md
Last active Apr 28, 2021
Safari iframe cookie workaround
View _safari-iframe-cookie-workaround.md
@lyzidiamond
lyzidiamond / blog.md
Last active Jul 14, 2017
First Transitmix Blog
View blog.md

Transitmix: Design Your Perfect Bus System

On June 19th at BETA, we had the pleasure of launching the public beta of Transitmix, a sketching tool for transit planners (both professional and armchair) to quickly design routes and share with the public. Transitmix is a cross-team, collaborative project that has received contributions from no fewer than eight 2014 fellows from more than seven different city teams*, and it has been an amazing opportunity for all of us to learn from each other, share skills, and build on each other's work to create something truly awesome.

Transitmix is the first tool of its kind. It allows users to draw bus routes on any city's road grid and specify frequency and times of service to determine estimated total cost of the system. Users can then share their maps for others to view and "remix" by adding, changing, or dele

@pinguet62
pinguet62 / Hexavigesimal.java
Last active Dec 28, 2020
The Hexavigesimal numeral system.
View Hexavigesimal.java
package fr.pinguet62.util;
/**
* Wrapper for hexavigesimal representation and conversions.<br />
* {@code 0} = {@code "A"}<br/>
* {@code 25} = {@code "Z"}<br/>
* {@code 26} = {@code "AA"}<br/>
* {@code 27} = {@code "AB"}<br/>
* {@code 730} = {@code "ABC"}
*/
@twolfson
twolfson / README.md
Last active Nov 26, 2019
CSS selector minifier concept
View README.md

CSS selector minification is a missed opportunity of saved bytes. Currently, Google uses it but not much beyond that.

The concept is change .box to .b and <div class="box"> to <div class="b">.

There is room for issues with JavaScript so that should be treated as a nice-to-have and be conservatively avoided.

Approach

To convert HTML and CSS, it would be a 2 step process:

Minify CSS selectors