This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <limits.h> | |
#include <string.h> | |
struct entry_s { | |
char *key; | |
char *value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ab PHP 5.4 steht für json_encode die Konstante JSON_PRETTY_PRINT zur Verfügung. | |
echo json_encode($arr, JSON_PRETTY_PRINT); | |
// Für PHP <= 5.3 gibt es folgende Alternative (Quelle Zend): | |
/** | |
* Pretty-print JSON string | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ares.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <netdb.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <ctype.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ares.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <netdb.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <ctype.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Installation | |
# - Move this to /etc/init.d/myservice | |
# - chmod +x this | |
# | |
# Starting and stopping | |
# - Start: `service myservice start` or `/etc/init.d/myservice start` | |
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*! @class SocketServer | |
@author Navarr Barnier | |
@abstract A Framework for creating a multi-client server using the PHP language. | |
*/ | |
class SocketServer | |
{ | |
/*! @var config | |
@abstract Array - an array of configuration information used by the server. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/10717190/convert-svg-polygon-to-path | |
//Open your SVG in a web browser. | |
//Run this code: | |
var polys = document.querySelectorAll('polygon,polyline'); | |
[].forEach.call(polys,convertPolyToPath); | |
function convertPolyToPath(poly){ | |
var svgNS = poly.ownerSVGElement.namespaceURI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
apt-get update | |
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make | |
mkdir -p /etc/php7/conf.d | |
mkdir -p /etc/php7/cli/conf.d | |
mkdir /usr/local/php7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cardList($card_id, $uppercase = false) | |
{ | |
if (!$card_id) return []; | |
$arr = []; | |
$arr[0] = $card_id; | |
$arr[1] = implode(array_reverse(str_split($card_id, 2))); | |
if (preg_match('/^[0-9]*$/', $card_id)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cardList(card_id, upeercase) { | |
if (!card_id) return []; | |
card_id += ''; | |
upeercase = !!(upeercase); | |
var arr = [], | |
dechex = function (number) { | |
return parseInt(number < 0 ? 0xFFFFFFFF + number + 1 : number, 10).toString(16) | |
}, str_split = function (str, split) { | |
if (!str) return false; | |
split = split || 1; |
OlderNewer