Skip to content

Instantly share code, notes, and snippets.

View sBuchhop's full-sized avatar

Stefan Buchhop sBuchhop

  • Hamburg, Germany
View GitHub Profile
@sBuchhop
sBuchhop / fb_flash_lb_trigger.js
Created February 6, 2012 09:57
Flash Facebook Like Button Trigger
/*
Implement FBs like button in flash is horrible. But implement the iFrame button, hide it and trigger it from js is not
Just to remember this snippet
*/
function fireEvent(element,event) {
if (document.createEventObject) {
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
@sBuchhop
sBuchhop / gd_text_helper.php
Created February 14, 2012 11:37
Two functions that help me handling Text in GD
<?php
function _calculateTextBox($text,$fontFile,$fontSize,$fontAngle)
{
/************
simple function that calculates the *exact* bounding box (single pixel precision).
The function returns an associative array with these keys:
left, top: coordinates you will pass to imagettftext
width, height: dimension of the image you have to create
*************/
$rect = imagettfbbox($fontSize,$fontAngle,$fontFile,$text);
@sBuchhop
sBuchhop / mail.php
Created February 17, 2012 11:52
PHP Mail - Encode Subject done right
<?php
$subject = "=?utf-8?B?".base64_encode('Lorem ipsum dolor. Subject must not be longer than 75 Chars including the Part with =?charset?encoding')."?=";
?>
@sBuchhop
sBuchhop / apache_cross_domain.conf
Created February 21, 2012 10:22
Apache Cross Domain AJAX
# ----------------------------------------------------------------------
# Cross-domain AJAX requests
# ----------------------------------------------------------------------
# Serve cross-domain ajax requests, disabled.  
# enable-cors.org
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
#  <IfModule mod_headers.c>
#    Header set Access-Control-Allow-Origin "*"
[global]
username map = /usr/local/etc/smbusers
server min protocol = SMB2_02
server max protocol = SMB3
interfaces = 127.0.0.1 192.168.2.5
bind interfaces only = yes
encrypt passwords = yes
dns proxy = no
strict locking = no
oplocks = yes