Skip to content

Instantly share code, notes, and snippets.

View frne's full-sized avatar

Frank Neff frne

View GitHub Profile
@frne
frne / core.js
Created November 3, 2011 16:36
Require.js and AMD
/**
* Maps core module
*
* @access public
* @author Frank Neff
*/
define("maps/core",
[
// require jQuery
"./javascriptlibs/jquery.js",
@frne
frne / count_utf8.js
Created November 11, 2011 15:56
Function to count bytes of a string (UTF8)
/**
* Function to fix native charCodeAt()
*
* Now, we can use fixedCharCodeAt("foo€", 3); for multibyte (non-bmp) chars too.
*
* @access public
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
* @note If you hit a non-bmp surrogate, the function will return false
* @param str String Mixed string to get charcodes
* @param idx Integer Position of the char to get
@frne
frne / jsoverlay.css
Created November 22, 2011 19:08
jsOverlay - A function to overlay a webpage
#jsOverlay
{
background-color: #ffffff;
opacity: 0.7;
filter: alpha(opacity=70);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
@frne
frne / pluginName.jquery.js
Created December 22, 2011 10:17
jQuery plugin pattern
/**
* jQuery plugin pattern
*
* An example or pattern for jQuery plugin authoring
*
*/
( function ( $ ) {
/**
@frne
frne / auth_response.xml
Created February 16, 2012 13:19
ejabberd, BOSH und Strophe.js
<body xmlns="http://jabber.org/protocol/httpbind"
sid="e0408bf8d86f0a7f44afda59aa8f81b75d029bb6"
wait="60"
requests="2"
inactivity="30"
maxpause="120"
polling="2"
ver="1.6"
from="ymc-pg-ejabberd"
secure="true"
# The test environment we want to use (PHP 5.3)
language: php
php:
- 5.3
- 5.4
before_script:
# Packages installation
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-mysql php5-sqlite
# Apache webserver configuration
- echo "Alias /behat $(pwd)/web" | sudo tee -a /etc/apache2/sites-available/default
@frne
frne / build.xml
Last active December 11, 2015 05:48
Make your PHP Build Workflow Env-Independent
<?xml version="1.0" encoding="UTF-8"?>
<project name="build" default="phpunit">
<target name="phpunit" depends="composer-install">
<exec executable="vendor/bin/phpunit" failonerror="true">
<!-- include group unit -->
<arg line="--group unit"/>
<!-- arg for test directory -->
<arg value="./"/>
</exec>
@frne
frne / test.php
Last active December 31, 2015 17:49
<?php
interface fooplan
{
function getReverseName();
}
class foo implements fooplan
{
private $name;
@frne
frne / repository.xml
Last active January 2, 2016 14:09
Some symfony tricks
<?xml version="1.0" ?>
<!-- configuring object repositories as services -->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="entity.repository.facebook_identity"
class="Doctrine\ORM\EntityRepository"
factory-service="doctrine.orm.entity_manager"
@frne
frne / ._readme.md
Last active May 7, 2021 17:06
Fancy Colors for (OSX-) Bash

Fancy Colors for (OSX-) Bash

Fancy console screenshot

Prerequisites

Git contrib-scripts and grc

Run commands in install.sh