Skip to content

Instantly share code, notes, and snippets.

@Andi-Lo
Andi-Lo / download-latest.sh
Created December 19, 2021 13:51
Download and extract latest version of a Github repository using curl
#!/bin/bash
# Change to your needs
TARGET_FOLDER='./your-folder'
OWNER=''
REPOSITORY=''
mkdir -p $TARGET_FOLDER
echo "Querying Github for latest version..."
/**
* Reconfigures current test suit to prevent angular components compilation after every test run.
* Forces angular test bed to re-create zone and all injectable services by directly
* changing _instantiated to false after every test run.
* Cleanups all the changes and reverts test bed configuration after suite is finished.
*/
export const configureTestSuite = () => {
const testBedApi: any = getTestBed();
const originReset = TestBed.resetTestingModule;
@jcavat
jcavat / Dockerfile
Last active February 25, 2024 13:58
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@nrobinaubertin
nrobinaubertin / app.component.ts
Created January 17, 2017 13:36
Exemple of ngb-date-parser-formatter implementation (ng-bootstrap)
import { NgbDatepickerConfig, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbDateFRParserFormatter } from "./ngb-date-fr-parser-formatter"
@Component({
providers: [{provide: NgbDateParserFormatter, useClass: NgbDateFRParserFormatter}]
})
export class AppComponent {}
@visitdigital
visitdigital / webhook.php
Last active September 20, 2022 02:51
Very Simple Facebook Chat Bot PHP Webhook Script Example
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
// Set this Verify Token Value on your Facebook App
if ($verify_token === 'testtoken') {
echo $challenge;
}
$input = json_decode(file_get_contents('php://input'), true);
@jiewmeng
jiewmeng / develop.js
Created March 21, 2016 01:00
NPM Script to run nodemon, browser-sync and watchify
'use strict';
/**
* Starts `nodemon` and `browser-sync`
*/
const path = require('path');
const fs = require('fs');
const nodemon = require('nodemon');
const browserSync = require('browser-sync').create();
@bellbind
bellbind / index.html
Last active October 20, 2016 15:38
[browser] drawing Japan map (with canvas)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="script.js"></script>
</head>
<body><body>
</html>
@samnabi
samnabi / config.php
Created February 1, 2016 18:41
Kirby v2: Shrink large images on upload
<?php
// Copy this code into your config.php file
// Replace the default $maxDimension to meet your needs
// Read more about Kirby's Panel hooks at https://getkirby.com/docs/panel/developers/hooks
// Shrink large images on upload
kirby()->hook('panel.file.upload', 'shrinkImage');
kirby()->hook('panel.file.replace', 'shrinkImage');
function shrinkImage($file, $maxDimension = 1000) {
@irees
irees / README.md
Last active December 10, 2020 11:50

Transitland Frequency Visualization

Accompanies blog post: Transit dimensions: Transitland Schedule API

The frequency.py script:

  • Fetches all trips on a given date, between a start time and end time, inside of a bounding box
  • Calculates the number of connections between every stop
  • Uses a colormap and line width to show more frequent service
  • Outputs a GeoJSON map as output.geojson
func EncodePolyline(coordinates []*Point) string {
if len(coordinates) == 0 {
return ""
}
factor := math.Pow(10, 5)
output := encode(coordinates[0].Lat, factor) + encode(coordinates[0].Lng, factor)
for i := 1; i < len(coordinates); i++ {
a := coordinates[i]