Skip to content

Instantly share code, notes, and snippets.

@alirezanet
alirezanet / Iran96-97.json
Last active March 17, 2024 14:41
List of provinces, states and cities of Iran with geographical coordinates (96-97 update)
[
{
"latitude": "34° 31' 24.924",
"longitude": "50° 0' 20.866",
"province": "مرکزی",
"state": "آشتیان",
"city": "آشتیان"
},
{
"latitude": "33° 40' 29.197",
@SeppPenner
SeppPenner / Installing Python 3.7.4 on Raspbian.rst
Last active May 9, 2024 21:52
Installing Python 3.7.4 on Raspbian

Installing Python 3.7.4 on Raspbian =================================

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.4. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).

@mateogianolio
mateogianolio / srt-to-json.js
Last active September 21, 2021 14:51
converts an SRT file into JSON
var fs = require('fs');
fs.readFile('subtitle.srt', function(error, data) {
if(error)
throw error;
var text = data.toString();
var lines = text.split('\n');
var output = [];
@Integralist
Integralist / Design Patterns: Adapter vs Facade vs Bridge.md
Last active March 27, 2024 08:22
Design Patterns: Adapter vs Facade vs Bridge

The three design patterns (Adapter, Facade and Bridge) all produce the result of a clean public API. The difference between the patterns are usually due to a subtle context shift (and in some cases, a behavioural requirement).

Adapter

The primary function of an Adapter is to produce a unified interface for a number of underlying and unrelated objects.

You will notice this pattern being utilised in many applications. For example, ActiveRecord (the popular Ruby ORM; object-relational mapping) creates a unified interface as part of its API but the code underneath the interface is able to communicate with many different types of databases. Allowing the consumer of the API to not have to worry about specific database implementation details.

The principle structure of this pattern is: