Skip to content

Instantly share code, notes, and snippets.

View chapterjason's full-sized avatar
🕳️
<- Insert Bug

chapterjason chapterjason

🕳️
<- Insert Bug
View GitHub Profile
@lyrixx
lyrixx / test.php
Last active November 10, 2023 14:27
Symfony Playgound with its Container and a custom configuration
<?php
use App\Kernel;
require __DIR__.'/vendor/autoload_runtime.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@shockdevv
shockdevv / weapons.js
Created December 21, 2020 22:17
GTA:V weapon hashes updated to latest DLC.
export const weapons = {
dagger: 2460120199,
bat: 2508868239,
battleaxe: 3441901897,
knuckle: 3638508604,
bottle: 4192643659,
crowbar: 2227010557,
unarmed: 2725352035,
flashlight: 2343591895,
golfclub: 1141786504,
@patrickward
patrickward / user-story-example
Last active September 22, 2022 13:43
User Story Example
Sourced from: https://medium.com/swlh/user-story-template-with-examples-244528bf9e7
Title: Returns and exchanges go to inventory.
Story
-----
As a store owner,
I want to add items back to inventory when they are returned or exchanged,
so that I can track inventory.
@progress44
progress44 / S3FileStream.php
Created April 26, 2020 09:47
Laravel response class to handle S3 file stream
<?php
namespace App\Http\Responses;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class S3FileStream
{
/**
@jlevy
jlevy / simple-hash.js
Last active May 11, 2024 21:19
Fast and simple insecure string hash for JavaScript
// These hashes are for algorithmic use cases, such as bucketing in hashtables, where security isn't
// needed and 32 or 64 bits is enough (that is, rare collisions are acceptable). These are way simpler
// than sha1 (and all its deps) or similar, and with a short, clean (base 36 alphanumeric) result.
// A simple, *insecure* 32-bit hash that's short, fast, and has no dependencies.
// Output is always 7 characters.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@posener
posener / go-shebang-story.md
Last active June 20, 2024 08:45
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@carlodaniele
carlodaniele / food-example-plugin.php
Last active August 22, 2021 09:00
An example plugin for WPMU DEV readers
<?php
/**
* @package Food_example_plugin
* @version 1.0
*/
/*
Plugin Name: Food example plugin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for WPMU DEV readers
Author: Carlo Daniele
@gabrieljmj
gabrieljmj / eg.js
Last active July 20, 2023 08:21
Psr4 implementation NodeJS
psr4.add('Gabrieljmj\\Blog\\', 'modules/gabrieljmj/blog/');
psr4.add('Gabrieljmj\\Blog\\Controller\\', 'modules/gabrieljmj/blog/constrollers/');
var postsController = psr4.use('Gabrieljmj\\Blog\\Posts'); //require('modules/gabrieljmj/blog/Posts')
var postsController = psr4.use('Gabrieljmj\\Blog\\Controller\\Posts'); //require('modules/gabrieljmj/blog/controllers/posts')