Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
<?php
// Standalone context.
define('PDFTOHTML_PATH', 'X:/PATH TO/workspace/_ouplayer_data/pdftohtml-0.39/pdftohtml.exe'); # Windows.
#define('PDFTOHTML_PATH', '/usr/bin/pdftohtml'); # Redhat 6.
require_once 'libraries/pdftohtml.php';
//( Or, CodeIgniter context. )
#$config['pdftohtml_path'] = '/usr/bin/pdftohtml';
#$this->load->library('pdftohtml');
@slowprog
slowprog / phabricator_readme.md
Created January 23, 2016 06:17 — forked from sparrc/phabricator_readme.md
Phabricator Ubuntu Installation Guide

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

# apt-get install mercurial subversion python-pygments sendmail imagemagick

Create necessary users and add phd-user to sudoers:

@slowprog
slowprog / docker-compose.yml
Last active March 7, 2018 16:05
Docker-compose for rancher, nginx and let's encrypt
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
@slowprog
slowprog / Docker ssh tunnel
Created July 3, 2018 22:33
How to SSH tunnel to a Docker container on a remote server
For example temporary connect to Postgres.
1. Expose the port within your Docker container to the remote server
```
# docker.example.com.yaml
version: '3.3'
services:
postgres:
@slowprog
slowprog / address-to-lat-lng-coordinates.md
Created July 8, 2018 23:26
Finding the latitude and longitude by address with the Google Maps API

Finding coordinates by address with the Google Maps API

<?php

// Google maps - Geocoding
function google_maps_search($address, $key = '')
{
    $url = sprintf('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s', urlencode($address), urlencode($key));
    $response = file_get_contents($url);
@slowprog
slowprog / embedded-file-viewer.md
Last active July 14, 2018 13:26 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive, Zoho

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

#!/bin/bash
#
### Description: Script for GitLab files backup. For files moving use https://rclone.org/.
### Example: bash gitlab_backup.sh
RCLONE_NAME=${1:-yandex}
DIST_DIR=${2:-gitlab}
SOURCE_DIR="/var/opt/gitlab/backups"
LOG_FILE="/var/log/gitlab_backup.log"
BACKUP_DATE=$(date +"%m-%d-%y")