Skip to content

Instantly share code, notes, and snippets.

View apfelbox's full-sized avatar
🥑
hi there!

Jannik apfelbox

🥑
hi there!
View GitHub Profile
@apfelbox
apfelbox / gist:3207987
Created July 30, 2012 15:56
Sanitizer
<?php
class Sanitizer
{
/**
* Returns a url-sanitized string
* @static
* @param string $string
* @return string
*/
@apfelbox
apfelbox / a.html
Created September 6, 2012 12:39
POST example
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
</head>
<body>
<input type="text" name="length" value="500" id="length" />
<button>Send</button>
@apfelbox
apfelbox / addons.txt
Created November 18, 2012 12:53
WoW-Addons Herdentier
## Spieler:
Shadowed Unit Frames http://www.curse.com/addons/wow/shadowed-unit-frames
ShadowedUF Aura Indicators http://www.curse.com/addons/wow/shadoweduf-grid
## Plaketten:
Tidy Plates http://www.curse.com/addons/wow/tidy-plates
Tidy Plates: Threat Plates http://www.curse.com/addons/wow/tidy-plates-threat-plates
@apfelbox
apfelbox / LineBreakPlugin.php
Last active December 14, 2015 06:09
Simple plugin for usage in Status.Net, so that the notices keep line breaks.
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009,2011 StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
parameters:
test: ["a", "b", 123]
# or
parameters:
test:
- "a"
- "b"
- 123
@apfelbox
apfelbox / AdminController.php
Last active December 14, 2015 20:09
PHPExcel + Symfony2
<?php
$participantModel = new ParticipantModel($this->container);
$filename = "participations_" . date("d_m_Y__H_i") . "_export.xls";
$excel = $participantModel->getExcelHandler();
$writer = \PHPExcel_IOFactory::createWriter($excel, "Excel5");
$handle = fopen("php://temp", "a");
$writer->save($handle);
@apfelbox
apfelbox / index.html
Created October 23, 2013 14:57
Retina CSS example
<!doctype html>
<html>
<head>
<title>CSS Sprites + Retina</title>
<meta charset="utf-8" />
<style type="text/css">
.with-retina,
.without-retina {
@apfelbox
apfelbox / fb-scroll.js
Created November 18, 2013 13:25
How to scroll in a facebook app
function _scrollToTop ()
{
FB.Canvas.getPageInfo(
function(pageInfo)
{
$({ y: pageInfo.scrollTop }).animate(
{ y: 0 },
{
@apfelbox
apfelbox / Extension.php
Created November 21, 2013 10:30
varargs in Twig custom functions
<?php
class Extension extends Twig_Extension
{
public function myFunc ()
{
var_dump(func_get_args());
}
@apfelbox
apfelbox / countries.php
Created January 13, 2014 15:58
Country List for usage in PHP. Generated by `\Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()`.
<?php
return array ( 'AF' => 'Afghanistan', 'EG' => 'Ägypten', 'AX' => 'Alandinseln', 'AL' => 'Albanien', 'DZ' => 'Algerien', 'UM' => 'Amerikanisch-Ozeanien', 'AS' => 'Amerikanisch-Samoa', 'VI' => 'Amerikanische Jungferninseln', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarktis', 'AG' => 'Antigua und Barbuda', 'GQ' => 'Äquatorialguinea', 'AR' => 'Argentinien', 'AM' => 'Armenien', 'AW' => 'Aruba', 'AZ' => 'Aserbaidschan', 'ET' => 'Äthiopien', 'QO' => 'Äußeres Ozeanien', 'AU' => 'Australien', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesch', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgien', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivien', 'BA' => 'Bosnien und Herzegowina', 'BW' => 'Botsuana', 'BV' => 'Bouvetinsel', 'BR' => 'Brasilien', 'VG' => 'Britische Jungferninseln', 'IO' => 'Britisches Territorium im Indischen Ozean', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgarien', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'CL' => '