Skip to content

Instantly share code, notes, and snippets.

// 1. Shorten the console log
const log = console.log.bind(document)
log("does it work?")
log("yes")
log(5)
// 2. Merge two arrays into one
const array1 = ["One", "Two", "Three"]
const array2 = ["Four", "Five", "Six"]
@sassman
sassman / App.svelte
Last active February 21, 2023 22:19
Timer in svelte
<script>
let s = 0;
let m = 0;
let active = false;
let timer;
function setActive(a) {
active = a;
if(!active) {
clearInterval(timer)
@Marocco2
Marocco2 / CamTool_2.py
Last active September 25, 2020 11:32
CamTool_2.py - Up to 2x performance, fixes bugs
'''
1.14.3 x64
kasperski95@gmail.com
'''
from classes.general import *
from classes.CubicBezierInterpolation import interpolation
from classes.Camera import cam
from classes.MouseLook import mouse
from classes.Replay import replay
@clue
clue / 2018-04-13 getting-started-with-reactphp-workshop-phpyorkshire.md
Last active December 16, 2023 12:33
Getting started with ReactPHP – Pushing real-time data to the browser (PHPYorkshire)

Think about "PHP" for a few seconds… What came to mind? It’s very likely you thought about your average product catalog, a blogging platform or how the platform is inferior to things like Node.js. But wait, it’s 2018! What if I told you PHP’s huge ecosystem has way more to offer and PHP is not inferior at all to its evil cousin Node.js?

Hands-on workshop given at PHPYorkshire (2018-04-13)

Getting started with ReactPHP – Pushing real-time data to the browser

In this hands-on tutorial you will learn about the core concepts of async PHP and why you too should care about ReactPHP being a real thing. The workshop has a strong focus on sparking the idea that PHP can be way faster and more versatile than you probably thought. Bring along an open mind and through lots of interesting examples and live demos learn why what sounds crazy at first might soon be a valuable addition in your toolbox.

You’re already familiar with PHP and want to learn what ReactPHP is all about? Then this tutorial is for you! We will

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@stiucsib86
stiucsib86 / gist:6759495
Last active June 20, 2021 02:27
PHP test file for CORS testing.
<?php
header("Content-Type: application/json");
// Allow Credentials
header('Access-Control-Allow-Credentials: true');
// Allow all origins
if (isset($_SERVER['HTTP_REFERER']) || isset($_SERVER['HTTP_ORIGIN'])) {
if (isset($_SERVER['HTTP_REFERER'])) {
// github.com/paulirish/jquery-ajax-localstorage-cache
// dependent on Modernizr's localStorage test
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
// Cache it ?
if ( !Modernizr.localstorage || !options.localCache ) return;
var hourstl = options.cacheTTL || 5;
var cacheKey = options.cacheKey || options.url.replace( /jQuery.*/,'' ) + options.type + options.data;
@coderofsalvation
coderofsalvation / RESTdoc
Last active June 7, 2022 01:43
Quickndirty bash-utility to generate REST-documentation from sourcecode comments into css-styles html (or plainhtml). Can be handy for inclusion into phpdoc/phpdoctor/doxygen-dochains, instead of using heavyweight alternatives.
#!/bin/bash
#
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments.
# (initially aimed at php-files, but js should also work)
# Basically its a c-style comment -> markdown -> html converter
# Dependancies:
# - awk
# - sed
# - bash
# - php
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 17, 2024 15:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@RaVbaker
RaVbaker / readme.md
Created March 30, 2012 20:12
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d