Skip to content

Instantly share code, notes, and snippets.

View klein0r's full-sized avatar
🏠
Working on my smart home

Matthias Kleine klein0r

🏠
Working on my smart home
View GitHub Profile
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@sbisbee
sbisbee / firstclass.php
Created December 17, 2010 23:08
First-class functions in PHP.
<?php
/*
* A demonstration of first-class functions in PHP.
* Blog post: http://www.sbisbee.com/blog.php?id=2352301864
*
* By Sam Bisbee <www.sbisbee.com> on 2010-12-17
*/
function makeLouder($fn)
{
@davidalexander
davidalexander / gist:1086455
Last active September 7, 2023 07:42
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@cordoval
cordoval / GroupBy.php
Created October 5, 2011 22:35 — forked from anonymous/GroupBy.php
Grouping filter for Twig.
<?php
namespace BlackRook\TaskBundle\Twig\Extension;
use DateTime,
Twig_Extension,
Twig_Environment,
Twig_TemplateInterface,
Twig_Error_Runtime,
Twig_Filter_Method;
@roderik
roderik / .travis.yml
Last active January 30, 2020 06:07
Installing Apache with PHP in Travis-CI
language: php
php:
- 5.3
- 5.4
before_script:
- sudo apt-get install apache2
- sudo a2enmod actions
- sudo a2enmod rewrite
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@upvalue
upvalue / amazon.rb
Last active December 23, 2016 06:01
Amazon affiliate filters for jekyll.
# amazon.rb - amazon affiliate links for jekyll
# assumes that you have a configuration variable called 'amazon_associate_id' with your associate id
# usage: {{ asin | amazon_product_href }}
# returns url of a product
# usage: {{ asin | amazon_image_href: 'M' }}
# returns image of the product, size argument can be S, M, or L, default M
# usage: {{ asin | amazon_product: 'A Product' }}
@messageagency
messageagency / pconnect.sh
Last active March 30, 2021 21:47
Pantheon DB Connection Script
#!/bin/sh
# exit on any errors:
set -e
if [ $# -lt 1 ]
then
echo "Usage: $0 @pantheon-alias"
exit 1
fi
@ScreamingDev
ScreamingDev / sendmail
Last active July 12, 2016 19:11
PHP local send mail (/usr/local/bin/sendmail)
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$filename = tempnam('/var/log/mail', date('ymd-his-') . $matches[1] . '.');
file_put_contents($filename, $input);
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

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 :