Skip to content

Instantly share code, notes, and snippets.

View Spaggel's full-sized avatar

Daniel van der Linden Spaggel

View GitHub Profile
@FalconNL93
FalconNL93 / .env
Created December 5, 2023 07:52
Rent a Tor
PUID=998
PGID=998
TIMEZONE=Europe/Amsterdam
@andyraddatz
andyraddatz / ASCIIStringExtensions.cs
Last active May 29, 2024 15:10
C# String extension method to fold diacritics to ASCII characters
// IMPORTANT
using System.Text;
// This gist was created thanks to this comment from Alexander on StackOverflow:
// https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net#comment86833005_34272324
// This is a derivative work. The logic of this function comes from a switch statement found inside the
// Lucene.Net library. The documentation of the conversion of characters is quite impressive
// (thank you @NightOwl888 and @synhershko !!!):
// https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/ASCIIFoldingFilter.cs
@z2z
z2z / winginx_patch.php
Last active July 11, 2019 08:58
WINGINX patch to support php 5.6 and 7.0
<?php
/*
src - https://stackoverflow.com/a/36291595
usage - php winginx_patch.php
After applying this patch you can use "php56", "php70" and "php71"
folders in the root directory of winginx.
*/
function patch($file, $offset, $old_data, $new_data) {
if (!$f = fopen($file, 'r+b')) {
die("Can not open $file");
// Zero-Clause BSD (more permissive than MIT, doesn't require copyright notice)
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active July 29, 2024 09:53
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@lstrojny
lstrojny / app--code--local--Varien--Autoload.php
Created April 16, 2013 11:27
Replace Magento autoloader with composer based autoloader. Note: you are losing the ability to use the compiler.
<?php
/**
* Classes source autoload
*/
class Varien_Autoload
{
/** @var \Composer\Autoload\ClassLoader */
private static $autoloader;
/** @var self */
@JeffreyWay
JeffreyWay / laravel.js
Last active August 3, 2024 16:51
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@accentinteractive
accentinteractive / dump_helper.php
Created October 5, 2012 07:09
dump_helper: functions to dump variables to the screen, in a nicley formatted manner
<?php
/**
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
* @author Joost van Veen
* @version 1.0
*/
if (!function_exists('dump')) {
function dump ($var, $label = 'Dump', $echo = TRUE)
{
// Store dump in variable
@nambok
nambok / MY_Input.php
Created October 4, 2012 14:53
Extends codeigniter input class to accept put and delete requests
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
/**
* Variables
*
*/
protected $delete;
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs