Skip to content

Instantly share code, notes, and snippets.

<?php
// See https://github.com/web-token/jwt-framework/tree/v1.3.9 for about JWT
function createAppleIDSecret()
{
$privateKey = file_get_contents('/path/to/your/key');
$keyId = 'key_id';
$teamId = 'team_id';
$clientId = 'client_id';
@ravishakya
ravishakya / multidimentionalArrayMap.php
Last active January 30, 2021 14:48
array_map for multidimensional array
function multidimentional_array_map( $function, $arr ){
$result = array();
foreach ($arr as $key => $val){
$result[$key] = (is_array($val) ? multidimentional_array_map($function, $val) : $function($val));
}
return $result;
}
@shingorow
shingorow / up-to-php7-in-cloud9.sh
Last active November 20, 2018 10:46
On Cloud9, upgrade PHP 5 to 7.
# Install phpbrew
sudo apt-get update
sudo apt-get install libmcrypt-dev
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/
phpbrew init
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc
@henriquemenezes
henriquemenezes / curl-upload-file.sh
Last active September 12, 2023 20:19
Using CURL to Upload Files
# curl - Raw upload
curl -X PUT -T image.png https://example.com/upload
# curl - Content-Type: multipart/form-data
curl -F name=logo -F file=@image.png https://example.org/upload
# curl - POST presigned URL (S3)
@jeremeamia
jeremeamia / aws-csv-streamwrapper.php
Created June 6, 2014 18:23
Shows how to read a CSV stored in S3 using the AWS SDK for PHP's S3 Stream Wrapper.
<?php
require __DIR__ . '/vendor/autoload.php';
$s3 = Aws\S3\S3Client::factory($config);
$s3->registerStreamWrapper();
$url = 's3://{$bucket}/{$key}';
// Read CSV with fopen
@amirkdv
amirkdv / php_mdb.rst
Last active August 25, 2023 13:14
How to handle MS Access MDB files in Linux with PHP5 PDO and ODBC

To be able to use PHP5 PDO with MS Access mdb files the following is required (the same applies for the PHP4 style of using odbc_X except for the obviously PDO specific requirements):

PHP ODBC module

In Linux this is achieved by intalling the php5-odbc package:

@yorkxin
yorkxin / rfc6750.md
Created September 17, 2013 07:54
RFC 6750 in Markdown - Edited from http://tools.ietf.org/rfc/rfc6750.txt
Internet Engineering Task Force (IETF)                          M. Jones
Request for Comments: 6750                                     Microsoft
Category: Standards Track                                       D. Hardt
ISSN: 2070-1721                                              Independent
                                                            October 2012

The OAuth 2.0 Authorization Framework: Bearer Token Usage

Abstract

@yorkxin
yorkxin / rfc6749.md
Last active April 6, 2022 11:54
RFC 6749 in Markdown - Edited from http://tools.ietf.org/rfc/rfc6749.txt
Internet Engineering Task Force (IETF)                     D. Hardt, Ed.
Request for Comments: 6749                                     Microsoft
Obsoletes: 5849                                             October 2012
Category: Standards Track
ISSN: 2070-1721

The OAuth 2.0 Authorization Framework

Abstract

@heldrida
heldrida / javascript
Last active March 11, 2024 17:00
Facebook Javascript SDK: Basic Login and Logout example
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'xxxxxxxxxxxxx',
status: true,
cookie: true,
xfbml: true
});
@jhjguxin
jhjguxin / nginx-403-forbidden-error-hosting-in-user-home-directory.md
Created August 12, 2013 05:40
nginx 403 forbidden error when server static file under user home directory