Skip to content

Instantly share code, notes, and snippets.

@mrardon
mrardon / gist:0958b30def0c5a00796b2d2f583c7f8d
Created May 6, 2022 17:44 — forked from alexandernl/gist:8090a79a7af4197c5f5571e8cc8c05b8
Convert daily New York Times frontpage to jpg
<?php
// set the output-file
$outputfile = "/var/www/nyt/nyt.jpg";
// set path to todays NYT frontpage
$pathToPdf="https://static01.nyt.com/images/".date('Y')."/".date('m')."/".date('d')."/nytfrontpage/scan.pdf";
// check if there is any today
$file_headers = @get_headers($pathToPdf);
@mrardon
mrardon / bumpme
Last active January 30, 2018 21:59
Tue Jan 30 21:59:08 UTC 2018
@mrardon
mrardon / polly_voices_home_automation.sh
Created December 1, 2016 00:00
Uses AWS CLI tool to create mp3s in current directory for each phrase for each english voice (requires bash version 4+). Tested on MacOS Sierra
#!/usr/local/bin/bash
declare -A array
array[1]="Front door closed"
array[2]="Front door opened"
array[3]="Garage door closed"
array[4]="Garage door closing"
array[5]="Garage door open"
array[6]="Garage door opening"
array[7]="Garage entry door closed"
@mrardon
mrardon / 1_security.yml
Created October 28, 2015 14:00 — forked from 77web/1_security.yml
How to switch user accounts between two(or more) different firewalls when using Symfony\Bundle\SecurityBundle
//you may have some more configs here...
providers:
user:
entity: { class: MyAppBundle:User, property: loginEmail }
admin:
entity: { class: MyAppBundle:Admin, property: username }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
#!/bin/bash
# Takes one parameter: a remote git repository URL.
#
# This is the stuff this script does:
#
# 1. Clones the repository
# 2. Fetches all remote branches
# 3. Compresses the folder
# 4. Deletes the cloned folder.
<?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)
@mrardon
mrardon / EntityHiddenType.php
Last active December 20, 2015 07:18 — forked from bjo3rnf/EntityHiddenType.php
There was an issue with the classes not working for me. It was expecting the class I provided it but obviously when going through the transformer it turned it into a string which != the original entity type.
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@mrardon
mrardon / phpunit.rb
Last active December 18, 2015 10:10 — forked from itspriddle/phpunit.rb
require 'formula'
class Phpunit < Formula
homepage 'http://www.phpunit.de/manual/current/en/index.html'
url 'http://pear.phpunit.de/get/phpunit.phar'
sha1 'e3644434a01dab6292b0d2319cc52e85a08ce807'
version 'HEAD'
def install
bin.install "phpunit.phar" => "phpunit"
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@mrardon
mrardon / wizard.html
Created October 10, 2012 13:46 — forked from foca/wizard.html
Wizard navigation in CSS (using Twitter Bootstrap)
<ol class="wizard-nav">
<li class="done"><a href="#">Step 1</a></li>
<li class="done"><a href="#">Step 2</a></li>
<li class="active"><a href="#">Step 3</a></li>
<li><a href="#" data-disabled>Step 4</a></li>
<li><a href="#" data-disabled>Step 5</a></li>
</ol>