Skip to content

Instantly share code, notes, and snippets.

@jmather
jmather / .vagrant.init.sh
Last active May 6, 2018 12:54
This is in my project's bin/.vagrant.init.sh which is looked for (and ran) by my custom vagrant provision.sh
#!/bin/sh
cp -f app/config/parameters.dist.yml app/config/parameters.yml
rm -rf app/cache/*
php app/console doctrine:database:create
php app/console doctrine:migrations:migrate --no-interaction
yes | php app/console doctrine:fixtures:load
php app/console cache:clear
php app/console assetic:dump
php app/console assets:install --symlink
@jmather
jmather / deploy.rb
Created August 30, 2012 05:51
Remove dev only files in production via capifony
set :dev_only_files, [web_path + "/app_dev.php", web_path + "/check.php", web_path + "/config.php"]
set :production, true
after 'symfony:cache:warmup', 'pff:productify'
namespace :pff do
desc "Remove app_dev.php, check.php and config.php from production deployment"
task :productify, :except => { :production => false } do
if dev_only_files
pretty_print "--> Removing app_dev.php, config.php, and check.php from web"
@veltman
veltman / tiles.md
Last active September 27, 2019 22:12
Making a big image zoomable

Making a big image zoomable

When you have a giant image and you want to make it easy to pan and zoom without downloading the whole 50MB image into someone's browser, a nice workaround is to cut that image into tiles at different zoom levels and view it as it were a map. An example where I've used this technique is The "Snowpiercer" Scenario.

One way to cut your big image into the requisite tiles is with gdal2tiles.py.

Alternatively, this Node script will do the cutting after you install node-canvas and mkdirp:

const fs = require("fs"),
@weaverryan
weaverryan / FeatureContext.php
Created June 19, 2012 21:05
Behat Definition to help click generic links on different rows of a table
<?php
// ...
class FeatureContext extends MinkContext
{
/**
* Looks for a table, then looks for a row that contains the given text.
* Once it finds the right row, it clicks a link in that row.
*
@oneohthree
oneohthree / quick-slugify.sh
Last active February 22, 2024 01:53
Quick bash slugify
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z