Skip to content

Instantly share code, notes, and snippets.

@k9ordon
k9ordon / gpxImport.php
Created July 16, 2012 08:35
exports nike+ runs to gpx
<pre>
strt importing gpx files ...
<?php
require_once 'lib/init.php'; // init $n stuff (login)
$dir = "import";
$runs = $n->activities();
foreach($runs->activities as $a) {
@r-sal
r-sal / PHPWord_snippets.md
Created December 18, 2012 02:39
PHPWord Snippets

PHPWord Snippets

// New Word Document
$PHPWord = new PHPWord();

// New portrait section
$section = $PHPWord-&gt;createSection();
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

<?php
# hello
# this is pure crap, don't even think about using it
# it doesn't filter input vars or contain ANY error handling at all
# i wrote this while putting a kid to bed in, january 2016
# i repeat: do not use this script
# i am peder@earthpeople.se, a ceo - not a real developer
# prerequisites
# you need an account at mathem
@Swop
Swop / Dominos.py
Created March 14, 2016 19:56
Check Domino's pizza delivery status and push an OSX notification after each status change. Yummy
import json
import urllib2
import sys
import time
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
orderId = sys.argv[1]
step = previousStep = None
@roydejong
roydejong / gitlab2nas.php
Last active February 12, 2024 03:10
Script: Backup all GitLab repositories to Synology NAS
<?php
// This script will back up all your GitLab repositories to a specified location.
// I recommend creating a seperate GitLab user for backups.
// You'll need to generate a personal access token for that user with API access (in GitLab).
// Next, generate a SSH keypair for the NAS user and attach it to the GitLab user.
// Finally, create a scheduled task in your NAS config to run this script: "php /some/location/git2nas.php"
// Config -- start
@vanous
vanous / grph.py
Created November 1, 2018 20:42
gadgedbridge simple data exploration
import sqlite3
import matplotlib.pyplot as plt
import datetime
import numpy as np
conn = sqlite3.connect('Gadgetbridge')
c = conn.cursor()
a=c.execute("select strftime('%Y.%m.%d', datetime(timestamp, 'unixepoch')) as d,sum(STEPS) from MI_BAND_ACTIVITY_SAMPLE group by d").fetchall()
b={x[0]:x[1] for x in a}
@mindplay-dk
mindplay-dk / php-upgrades.md
Last active June 11, 2024 10:30
PHP upgrades

Upgrading PHP

Guidelines for upgrading the minimum PHP version requirements of packages and projects.

This isn't meant to be an exhaustive guide to upgrading, but as a checklist for the most important upgrades.

PHP 5.3

The first version to support namespaces - any relevant PHP packages/projects usually have this version as the minimum requirement, so this document won't concern itself with upgrades prior to that.

@PrestaEdit
PrestaEdit / composer.json
Last active December 14, 2021 16:53
PrestaShop Validator API (Example)
{
"name": "prestashop/validator",
"authors": [
{
"name": "Prestashop"
}
],
"require": {
"guzzlehttp/guzzle": "^7.0"
}