Skip to content

Instantly share code, notes, and snippets.

View iksi's full-sized avatar
🤞

Jurriaan iksi

🤞
View GitHub Profile
@iksi
iksi / server.php
Created November 3, 2017 10:52
server.php for kirby
<?php
// removes querystrings
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $path)) return false;
// what the .htaccess would normally do
if (preg_match('/^\/panel\/(.*)/', $path)) {
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'panel' . DIRECTORY_SEPARATOR . 'index.php';
@iksi
iksi / server.php
Last active October 18, 2017 07:39
Let all other requests than file get passed to the script on duty. Use with `php -S localhost:8888 server.php`.
<?php
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) return false;
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'index.php';
require_once $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'];
// put this inside a function to check the time it takes to complete
var start = performance.now()
// do stuff
var duration = performance.now() - start
console.log(duration)
@iksi
iksi / copydir.php
Last active September 12, 2017 20:23
copy a directory and it's files recursively
<?php
function copyDirectory($sourceDirectory, $destinationDirectory) {
// determine the files that need to be copied
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($sourceDirectory, FilesystemIterator::SKIP_DOTS)
);
foreach ($files as $file) {
$sourcePath = $file->getPathname();
$destinationPath = $destinationDirectory . DS . $sourcePath;

Keybase proof

I hereby claim:

  • I am iksi on github.
  • I am iksi (https://keybase.io/iksi) on keybase.
  • I have a public key ASBD9jM2bNQypuCqFuG4tw_rR6MMQoOYtw4cQ5WhS-PfNAo

To claim this, I am signing this object:

# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
# Set colors to match iTerm2 Terminal Colors
export TERM=xterm-256color
@iksi
iksi / Preferences.sublime-settings
Created January 4, 2017 17:59
Sublime Text settings
{
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 3,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
"font_face": "Replica Mono Pro",
"font_size": 15,
"highlight_line": true,
var getScrollPosition = function () {
return {
x: Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft),
y: Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop)
};
};
var supportsScrollBehavior = function () {
return 'scrollBehavior' in document.documentElement.style;
};
var isModernBrowser = function () {
return 'visibilityState' in document;
};