Skip to content

Instantly share code, notes, and snippets.

View Rayne's full-sized avatar
⚠️
I may be slow to respond.

Dennis Meckel Rayne

⚠️
I may be slow to respond.
View GitHub Profile
@Rayne
Rayne / config.ini
Created December 22, 2019 13:09
Fat-Free Framework + Environment Variables in configuration files
[globals]
foo=bar
baz={{@foo}}
ENV_VALUE={{ getenv('ENV_VALUE') }}
@Rayne
Rayne / F3PHPUnitTest.php
Created May 23, 2015 11:07
Basic FatFreeFramework/Base->mock() + PHPUnit example
<?php
class F3PHPUnitTest extends PHPUnit_Framework_TestCase {
public function test() {
$f3 = Base::instance();
// Don't write to STDOUT
$f3->set('QUIET', true);
$f3->route('GET /path', function(){ echo 'TEXT'; });
@Rayne
Rayne / index.php
Created February 16, 2017 15:18
Fat-Free Framework with PHP Debugger Tracy
<?php
/**
* The following example combines Fat-Free Framework
* with the PHP Debugger (Toolbar) Tracy.
*
* @see https://github.com/bcosca/fatfree/issues/999
*/
use Tracy\Debugger;
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@Rayne
Rayne / readme.md
Created August 13, 2018 12:33 — forked from xem/readme.md
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@Rayne
Rayne / example.php
Last active February 1, 2017 14:29
Fat-Free Framework: Mapper with ONLOAD event and custom derived non-virtual fields
<?php
/**
* This snippet is part of an answer to a StackOverflow question
* and is executable as soon as line 11 gets corrected
* to include Fat-Free Framework's `base.php` file.
*
* @see http://stackoverflow.com/questions/41840876/using-computed-properties-on-fatfree-mapper-object-not-retrieved-from-database
*/
@Rayne
Rayne / UI somefile.html
Created November 20, 2015 13:25
Fat-Free Framework: New `$ttl` attribute for <include>
<h2>somefile.html</h2>
<p>{{ time() }}</p>
package com.example.test_loader;
import java.util.Calendar;
import android.app.Activity;
import android.app.LoaderManager;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.AsyncTaskLoader;
import android.content.Context;
import android.content.Loader;
@Rayne
Rayne / articles.html
Created November 28, 2015 17:17
Fat-Free Framework: Templating with objects and the `Template` class
<repeat group="{{ @articles }}" value="{{ @article }}">
<h1>{{ @article->title }}</h1>
</repeat>
@Rayne
Rayne / index.php
Created November 21, 2015 09:37
Fat-Free Framework: TTL tests for `View` and `Preview` (`Template`)
<?php
require 'base.php';
$f3 = Base::instance();
$f3->DEBUG = 3;
$f3->UI = 'UI/';
$f3->CACHE = 'folder=tmp/cache/';
$f3->TEMP = 'tmp/temp/';