Skip to content

Instantly share code, notes, and snippets.

@otanodesignco
otanodesignco / reverse
Created June 20, 2013 16:03
Pure php implementation of the reverse method from the C++ std.
<?php
function reverse( $text )
{
$txtLen = strlen( $text );
$rtn = "";
for ( $i = $txtLen - 1; $i >= 0; $i-- )
{
$rtn .= $text{$i};
@otanodesignco
otanodesignco / payment.php
Created June 20, 2013 17:27
Php code that determines the payment on a loan. Taken from Visual Basic.
<?php
function RentalPayment($Principle, $IntRate, $PayPerYear, $NumYears)
{
$numer; $denom; $b; $e;
$numer = $IntRate * $Principle / $PayPerYear;
$e = -($PayPerYear * $NumYears);
$b = ($IntRate / $PayPerYear) + 1;
@otanodesignco
otanodesignco / triangle.php
Created June 20, 2013 17:31
Calculate the Hypotenuse of a Triangle give the A & B sides.
<?php
function hypotenuse($A, $B)
{
if(is_numeric($A) && is_numeric($B))
{
return sqrt(($A * $A) + ($B * $B));
}
else
{
@otanodesignco
otanodesignco / ipclone.php
Created June 20, 2013 17:51
IP Chicken Clone
<?php
$ip = $_SERVER["REMOTE_ADDR"];
$port = substr($_SERVER["REMOTE_PORT"],0,2);
$browser = $_SERVER["HTTP_USER_AGENT"];
$hostname = gethostbyaddr($ip);
@otanodesignco
otanodesignco / stringtochararray.php
Created June 20, 2013 18:26
Turn a string into a character array.
<?php
function strToCharArray($text)
{
$txtLen = strlen($text);
$charArray;
for($i = 0; $i < $txtLen; $i++)
{
$charArray[$i] = $text{$i};
}
$ServerModules = '';
$ApacheMods = apache_get_modules();
foreach($ApacheMods as $mods)
{
$ServerModules .= "${mods}<br />";
}
echo $ServerModules;
<?php
$phpExt = '';
$phpLoadedExt = get_loaded_extensions();
foreach($phpLoadedExt as $ext)
{
$phpExt .= "${ext}<br />";
}
echo $phpExt;
@otanodesignco
otanodesignco / hook.php
Created April 14, 2019 02:00
php hook system
<?php
class hookSystem
{
/**
* @abstract Objects array
* @access Private
*/
private static $objects = array();
/**
* @abstract Settings array
@otanodesignco
otanodesignco / gulpfile.js
Created August 20, 2019 01:08
Gulp file for 8/19/2019 for browsersync, and scss compile
const {task, dest, src, watch, series} = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const browsersync = require('browser-sync').create();
sass.compiler = require('node-sass');
function style(cb)
{
return src('./assets/styles/sass/**/*.scss')
.pipe(sourcemaps.init())
@otanodesignco
otanodesignco / .glsl
Created July 29, 2023 17:22
view direction
out vec3 vViewDirection; // varying to send to the fragment shader
void main()
{
vec4 viewDirection = modelViewMatrix * vec4( position, 1.0 );
vViewDirection = viewDirection.xyz; // set view direction per pixel
gl_Position = projectionMatrix * viewDirection;