Skip to content

Instantly share code, notes, and snippets.

@tobyokeke
tobyokeke / Idempotency.php
Created April 24, 2020 12:34
Laravel Idempotency Middleware
<?php
namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\Cache;
class Idempotency
{
@slorber
slorber / react-navigation-tree.jsx
Last active August 13, 2022 19:17
react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
@josephrocca
josephrocca / generate.js
Last active April 9, 2025 05:07
Generate map tiles from a large image with nodejs
// Given a large input image, this script generates map tiles of 256*256px
// at power-of-2 zoom levels. It's not super efficient or anything, just a
// quickly hacked together script.
//Use the tiles in leaflet.js like this:
/*
<div id='map' style='height:100%;'></div>
<script>
var map = L.map('map', {
attributionControl: false
@nikoncode
nikoncode / add.php
Created August 29, 2013 21:15
long polling
<?php
$db = new mysqli("localhost", "root", "", "test");
$db->query("INSERT INTO messages (text, time) VALUES ('".$_POST["text"]."', '".time()."');");
@mariuz
mariuz / DriverExample.java
Created June 23, 2011 19:54
Firebird driver example using jaybird-full jar
// Original version of this file was part of InterClient 2.01 examples
//
// Copyright InterBase Software Corporation, 1998.
// Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
//
// Code was modified by Roman Rokytskyy to show that Firebird JCA-JDBC driver
// does not introduce additional complexity in normal driver usage scenario.
//
// A small application to demonstrate basic, but not necessarily simple, JDBC features.
//