Skip to content

Instantly share code, notes, and snippets.

View abrkof's full-sized avatar

abrkof abrkof

View GitHub Profile
@abrkof
abrkof / codeigniter-apache-hhvm.md
Created March 13, 2018 16:08 — forked from shivaas/codeigniter-apache-hhvm.md
CodeIgniter with Apache & HHVM as FastCGI

Apache Configuration:

<VirtualHost *:80>
  ServerName blah.com

  DirectoryIndex index.html index.php
  ProxyRequests On
  ProxyPreserveHost On
  ProxyVia full
@abrkof
abrkof / hhvm-codeigniter
Created March 13, 2018 16:09 — forked from intruxxer/hhvm-codeigniter
Hiphop-php HHVM working with Codeigniter and Nginx
I managed to make Codeiniter work with HHVM, using
nginx as a proxy. My problem was that hhvm has problems
with path_info, so I was not able to run /index.php/controller/action or
/controller/action/params -> /index.php/controller/action.params.
I used nginx as a proxy to hhvm. I changed the way codeigniter process
the url. Steps bellow:
Cleaned my HHVM .hdf file:
Server {
@abrkof
abrkof / PushNotifications.php
Created April 24, 2018 22:20 — forked from joashp/PushNotifications.php
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@abrkof
abrkof / cryptor.php
Created April 24, 2018 23:11 — forked from petermuller71/cryptor.php
PHP Encryption and decryption class with open_ssl (works also with large text)
<?php
/************************************************************************************************************************************************
*
* Class: Cryptor
*
* PHP Encryption and decryption class with open_ssl
*
* Works also with larger text (because text is split in smaller parts).
* Generates a random IV with openssl_random_pseudo_bytes for each message and is prefixed to the encrypted_text.
@abrkof
abrkof / lorempixel-local.md
Created May 28, 2018 23:36 — forked from rsp/lorempixel-local.md
Local lorempixel

How to quickly download Lorempixel images.

You can directly use URLs like this: http://lorempixel.com/400/300/nature/1/ but they will be downloaded every time from the Lorempixum server (they are not cached). For better performance or cache control you may want to save them locally. You can use cURL with its little known syntax for its input and -o arguments to do it easily.

Save filenames like nature-400x300-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#4-#2x#3-#5.jpg'
@abrkof
abrkof / index.ios.js
Created July 11, 2018 15:42 — forked from fernandiez/index.ios.js
Creando una aplicación móvil con React Native usando WordPress REST API
/**
* BetaBeers React Native App with WP REST API v 1.0
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@abrkof
abrkof / gps_ajax.php
Created July 16, 2018 16:57
Arduino GPS SQL/PHP/Javascript Google Maps API
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
require("connection.php");
// Opens a connection to a MySQL server
$connection=mysql_connect ($dbhost, $dbuser, $dbpass);
if (!$connection) {
@abrkof
abrkof / Instructions
Created August 13, 2018 17:19 — forked from philbirnie/Instructions
Steps to Combine Wordpress and Codeigniter when CI is in a subdirectory of Wordpress
Instructions
1. Add MY_url_helper.php to CI_directory/application/helpers
2. If the CI app is already built, convert any references to *site_url* in your CI application (aside from the system directory) to the new namespaced function, ci_site_url.
This step prevents Wordpress' site_url function from overwriting CIs. Because both functions are global and CI checks to make sure that site_url has not been set. Once we load the WP bootstrap file, it will have been defined, so CI's function wll never load.
3. Add Wordpress' bootstrap file into CI_directory/index.php right above CI's bootstrap file.
4. Update wp-includes/load.php *(this is necessary if you are using CI's sessions - Wordpress mangles CI's cookies using with magic quotes. (There may be an upgrade-proof way to do this.)
@abrkof
abrkof / directions_view.php
Created August 20, 2018 17:28 — forked from mitchellhislop/directions_view.php
PHP Google Directions API
<head>
<title>Your Trail</title>
</head>
<body>
<h1>Your Trail</h1>
<?php
echo "<br />";
echo '<h1>Directions:</h1>';
echo '<h2>Start: '.$origin.'</h2>';
foreach ($directions->route as $route)
@abrkof
abrkof / REST_PHP_set_note_attachment.php
Created September 20, 2018 22:24 — forked from sugarknowledge/REST_PHP_set_note_attachment.php
PHP Example using cURL with the v4 REST API to create a note with an attachement
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();