Skip to content

Instantly share code, notes, and snippets.

@matula
matula / awesm.md
Last active February 19, 2024 16:23
Awesome PHP stuff in one Gist
Library "Roku_Ads.brs"
sub init()
print "PlayerTask.brs [init]"
m.top.functionName = "playContentWithAds"
m.top.id = "PlayerTask"
end sub
sub playContentWithAds()
print "PlayerTask.brs [playContentWithAds]"

Keybase proof

I hereby claim:

  • I am matula on github.
  • I am matula (https://keybase.io/matula) on keybase.
  • I have a public key ASDWtZbNI9uI4Tfizwme1WTwq2foq7_3bxY5_cqgIbYd2go

To claim this, I am signing this object:

@matula
matula / PushNotifications.php
Created February 22, 2017 03:41 — 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";
@matula
matula / array.php
Created January 7, 2014 19:59
loop through an array
<?php
$social_data = [
[
'first' => 'John',
'middle' => 'Smith',
'last' => 'Doe',
'email' => 'abc@example.com'
],
[
@matula
matula / routes.php
Created November 27, 2013 23:01
I was trying to have URLs like "http://example.com/myusername" and "http://example.com/myusername/about". Using Laravel, you're able to throw a wildcard in the prefix. The route needs to go at the end of the routes.php file if you have other static routes. #laravel
<?php
// Routes for usernames
Route::group(['prefix' => '{username}', 'before' => 'valid-user'], function()
{
Route::get('/', 'UserController@index');
Route::get('about', 'UserController@about');
});
// Check to make sure the user is valid
Route::filter('valid-user', function($route, $request)
@matula
matula / parseGithub.php
Created November 25, 2013 21:42
Sir Trevor JS block to pull in GitHub data
<?php
public function parseGithub()
{
// Get the URI segments. Example: http://github.com/github/repo
$url = explode('/', trim(parse_url($_GET['url'], PHP_URL_PATH), '/'));
// Add segments to API endpoint. The 1st segment is the user, the second the repo
$api_url = 'https://api.github.com/repos/' . $url[0] . '/' . $url[1];
// Curl to get the json
@matula
matula / soundcloud.js
Created November 23, 2013 01:48
Custom Sir Trevor JS block for embedding Soundcloud
/**
* Block for a Soundcloud link
*/
SirTrevor.Blocks.Soundcloud = (function(){
return SirTrevor.Block.extend({
type: 'Soundcloud',
title: 'Soundcloud',
@matula
matula / main.blade.php
Created November 21, 2013 22:58
Adding in the Sir Trevor JS library into a PHP project using Laravel.
<!-- Not the FULL view -->
<link rel="stylesheet" href="{{ url('css/sir-trevor-icons.css')}}" type="text/css">
<link rel="stylesheet" href="{{ url('css/sir-trevor.css')}}" type="text/css">
<!-- Using some Bootstrap here -->
<div class="container">
<div class="row" id="post-form-container">
<h3>Create A Post</h3>
<form method="post" action="form" id="post-form" role="form">
<div class="form-group">
@matula
matula / gist:4961339
Last active December 13, 2015 19:18
Strong Password Validation. This was used by a gov't site that needed to use these rules.
<?php
/**
* Rule: strongPassword. Client requirements for a strong password
*
* @param string $field password
* @return boolean
*/
public function strongPassword($field) {
// Set RegEx values
$rule_uppercase = '/[A-Z]/';