// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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) { |
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 :
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 [email protected], a ceo - not a real developer | |
# prerequisites | |
# you need an account at mathem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "prestashop/validator", | |
"authors": [ | |
{ | |
"name": "Prestashop" | |
} | |
], | |
"require": { | |
"guzzlehttp/guzzle": "^7.0" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Helpers; | |
/** | |
* Office Open XML Encrypter | |
* | |
* Ported to PHP from xlsx-populate package Encryptor class, written in JavaScript: | |
* https://github.com/dtjohnson/xlsx-populate/blob/master/lib/Encryptor.js | |
* |
OlderNewer