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') }}
<?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 / 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;
@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 / 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/';
@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>
@Rayne
Rayne / index.php
Last active November 10, 2015 22:52
Fat-Free Framework: Session CSRF Tests
<?php
require 'base.php';
$f3 = Base::instance();
/**
* @see https://github.com/bcosca/fatfree/issues/878
*/
$f3->route('GET /session/@backend', function(Base $f3, array $args){
@Rayne
Rayne / index.php
Created August 8, 2015 15:37
Fat-Free Framework: Adding new filters to Preview and Template
<?php
require_once "../vendor/autoload.php";
class ExtTemplate extends Template {
public function date($timestamp) {
return date('d-m-Y' , $timestamp);
}
}