Skip to content

Instantly share code, notes, and snippets.

View tobya's full-sized avatar

Toby Allen tobya

View GitHub Profile
@jon
jon / BPUUID.h
Created February 3, 2010 21:09
An Objective-C wrapper for CFUUID
//
// BPUUID.h
// Skates
//
// Created by Jon Olson on 2/3/10.
// Copyright 2010 Ballistic Pigeon, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@anchetaWern
anchetaWern / laravel-ums.markdown
Created December 6, 2012 11:14
Building a User Management System in Laravel

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@fcingolani
fcingolani / import_csv_to_sqlite.php
Last active April 8, 2024 02:52
PHP function to import a CSV into an SQLite database. Creates a table if needed. Uses PDO.
<?php
function import_csv_to_sqlite(&$pdo, $csv_path, $options = array())
{
extract($options);
if (($csv_handle = fopen($csv_path, "r")) === FALSE)
throw new Exception('Cannot open CSV file');
if(!$delimiter)
$delimiter = ',';
@jacktasia
jacktasia / imgix_purge.php
Created January 4, 2015 01:45
imgix PHP purge example
<?php
// find your api key on the bottom of page @ https://webapp.imgix.com
define('IMGIX_API_KEY', '');
// pass the url you want to purge
function imgix_purge($url) {
$headers = array(
'Content-Type:application/json',
'Authorization: Basic '. base64_encode(IMGIX_API_KEY.':')
@jsteemann
jsteemann / git-log-to-json.php
Created March 11, 2015 11:41
script to convert local git commit log into JSON
<?php
// script to convert local git commit log history into JSON format
// usage: cd git-repository && php git-log-to-json.php > commits.json
// script might take a while to execute
$tags = [ ];
$lines = shell_exec('git show-ref --tags');
foreach (array_filter(explode("\n", $lines)) as $line) {
list($commit, $ref) = explode(" ", $line, 2);
@mwpastore
mwpastore / 00README.md
Last active July 18, 2024 08:32
Lightning Fast WordPress: Caddy+Varnish+PHP-FPM

README

This gist assumes you are migrating an existing site for www.example.com — ideally WordPress — to a new server — ideally Ubuntu Server 16.04 LTS — and wish to enable HTTP/2 (backwards compatibile with HTTP/1.1) with always-on HTTPS, caching, compression, and more. Although these instructions are geared towards WordPress, they should be trivially extensible to other PHP frameworks, other FastCGI backends, and even non-FastCGI backends (using proxy in lieu of fastcgi in the terminal Caddyfile stanza).

Quickstart: Use your own naked and canonical domain names instead of example.com and www.example.com and customize the Caddyfile and VCL provided in this gist to your preferences!

These instructions target Varnish Cache 4.1, PHP-FPM 7.0, and Caddy 0.10. (I'm using MariaDB 10.1 as well, but that's not relevant to this guide.)

@brilvio
brilvio / .gitlab-ci.yml
Created March 5, 2018 20:42
Gitlab-CI Delphi
stages:
- build
test:
stage: build
environment:
name: staging
script:
- git submodule update --init --remote #if you don't have submodules in your project you can remove this line
- SET BDS=C:\\Program Files (x86)\\Embarcadero\\Studio\\15.0
@1242035
1242035 / composer-private-package-github-token.md
Created July 28, 2021 01:43 — forked from MikeiLL/composer-private-package-github-token.md
Generate a GitHub Personal Access Token for Private Composer Packages

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.