Skip to content

Instantly share code, notes, and snippets.

View Martin1982's full-sized avatar
🤓
Solving problems

Martin de Keijzer Martin1982

🤓
Solving problems
View GitHub Profile
@Martin1982
Martin1982 / helloworld.php
Created March 12, 2012 19:13
PHP Hello WOrld
<?php
echo "Hello world!";
?>
@Martin1982
Martin1982 / constant.php
Created March 12, 2012 19:21
Constants
<?php
define('MY_CONSTANT_NAME','The value of my constant');
echo MY_CONSTANT_NAME;
// This will show 'The value of my constant' on your screen
?>
@Martin1982
Martin1982 / variable.php
Created March 12, 2012 19:22
Variables
<?php
$newVariable = 'Hello World';
echo $newVariable;
?>
@Martin1982
Martin1982 / variable-manipulation.php
Created March 12, 2012 19:23
Variable manipulation
<?php
$newVariable = 'Hello World';
echo $newVariable;
$newVariable = 'Goodbye World';
echo $newVariable;
?>
<?php
$categories = array('my first category', 'another one', 'etc');
?>
<?php
echo "My first category is " . $categories[0]
?>
@Martin1982
Martin1982 / associative-arrays.php
Created March 12, 2012 19:27
Associative arrays
<?php
$categories = array(
'first' => 'my first category',
'second' => 'new category',
'third' => 'etc...'
)
// Show the second category
echo "The second category is " . $categories['second'];
?>
@Martin1982
Martin1982 / nested-arrays.php
Created March 12, 2012 19:28
Nested arrays
<?php
$shop = array(
'electronics' => array(
'stereo set',
'speakers'
'tv'
),
'software' => array(
'games',
'office',
@Martin1982
Martin1982 / run-myemu.sh
Created July 25, 2012 22:08
A boot file for the Boot 2 Gecko emulator with loads of logging
#!/bin/bash
B2G_HOME=$PWD
. load-config.sh
DEVICE=${DEVICE:-generic}
TOOLS_PATH=$B2G_HOME/out/host/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/bin
DBG_CMD=""
@Martin1982
Martin1982 / uastring.php
Created August 16, 2012 07:47
A little script to utilize the http://useragentstring.com API
<?php
// Test script for detecting the OS by user agent string
// uses the API from http://www.useragentstring.com
// Do not forget to add caching! Continuously hitting the
// API is bad for performance of both the API and your
// application.
$apiParams = array(
'uas' => $_SERVER['HTTP_USER_AGENT'],
'getJSON' => 'os_name'