Skip to content

Instantly share code, notes, and snippets.

View codemasher's full-sized avatar
🏳️‍🌈

smiley codemasher

🏳️‍🌈
View GitHub Profile
String.prototype.midTruncate = function(length, seperator){
var left, right;
length = length || 30, left = Math.ceil(length/2), right = Math.floor(length/2);
seperator = seperator || '…';
if (this.length<=(length+1)) return this.toString();
return this.slice(0,left).strip()+seperator+this.slice(-right,this.length).strip();
};
@ViskoB
ViskoB / gw2_emblems_gd.php
Last active December 18, 2015 02:09
An attempt to colour Guild Wars 2 guild emblems using PHP and the GD library
<?php
/* Guild Wars 2 Emblem Creator Script by Moturdrn.2837
Special thanks to:
- Cliff Spradlin and ArenaNet for making available the API and information
- smiley.1438 and Think.8042 with PHP colour conversion
- smiley.1438 for the gw2_api_request function
- Dr Ishmael.9685 for providing information and downloads of the emblem parts and backgrounds, and the idea to split the matrix and colour conversion functions
- Killer Rhino.6794 for the extra advanced information on working out how to decode the API colour information into something useable
- The general Guild Wars 2 development community for being a bunch of guys and gals ready and willing to help one another out
- Apologies if I've left you out, please contact me and I'll add you in here :)
@krakjoe
krakjoe / pool.md
Last active January 30, 2020 12:33
Pooling

Easy pthreads Pools

The final solution !!

Since the first version of pthreads, PHP has had the ability to initialize Worker threads for users. Onto those Worker threads are stacked objects of class Stackable for execution concurrently.

The objects stacked onto workers do not have their reference counts changed, pthreads forces the user to maintain the reference counts in userland, for the extremely good reason that this enables the programmer to keep control of memory usage; and so, execute indefinitely.

This is the cause of much heartache for newcomers to pthreads; if you do not maintain references properly you will, definitely, experience segmentation faults.

@krakjoe
krakjoe / php-xz.patch
Created August 19, 2019 13:41
php-xz php7
diff --git a/config.m4 b/config.m4
index 90bbe66..e3ffe7c 100644
--- a/config.m4
+++ b/config.m4
@@ -1,47 +1,10 @@
dnl $Id$
dnl config.m4 for extension xz
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
@0xabad1dea
0xabad1dea / severscam.md
Last active July 12, 2021 01:32
Sever Scam

The Scammiest Scam To Yet Anonymity Scam

I'm still holding out for this being a hoax, a big joke, and that they're going to cancel the kickstarter any minute. It'd be quite the cute "lessons learned" about anonymity scams. However, I will be treating it from here on out as a genuine scam. (As of May 2nd, the kickstarter has been cancelled, after the strangest attempt to reply to this imaginable. Good riddance.)

This absolutely ridiculous thing was brought to my attention by a friend and since it was late at night I thought I must be delirious in how absurdly over the top fake it seemed. So I slept on it, woke up, and found that it had gotten a thousand dollars more funding and was every bit as flabbergasting as I thought it was.

Since I realize that not everyone has spent their entire lives studying computers – and such people are the targets of such scams –

@darthmaim
darthmaim / v2
Last active August 23, 2021 11:30
Tracks changes of https://api.guildwars2.com/v2 (hourly)
** Public API v2 **
Usage:
The API follows the general pattern of enumerating possible values of the
subsequent path segment, with the fully qualified path yielding a json object
of the type being enumerated.
For example, /v2/colors will yield:
[1, 2, 3, ... ]
@LeaVerou
LeaVerou / RAINBOWlog.js
Created March 12, 2014 23:30
AWESOMEify your console.log()ing! Because life is too short to be black & white!!!!!!1111one
(function(){
var log = console.log;
console.log = function(str) {
var css = 'background: linear-gradient(to right, red, yellow, lime, aqua, blue, fuchsia, red); color: white; font-weight: bold;';
var args = Array.prototype.slice.call(arguments);
args[0] = '%c' + args[0];
args.splice(1,0,css);
return log.apply(console, args);
}
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions

Elon Musk's suspension reversals

The tables below show notable Twitter suspension reversals for each day since Elon Musk took over as owner and CEO.

All dates indicate when the suspension or reversal was detected, and the actual suspension or reversal may have been earlier. For most English-language accounts with large followings, this lag will generally not be longer than a few hours, but for accounts that have a small number of followers or that are outside the networks we are tracking, the difference can be larger, and in some cases an account on the list may have had its suspension reversed before 27 October 2022. These dates will get more precise as we refine the report.

Because of these limitations, this report should be considered a starting point for investigation, not a definitive list of suspension reversals.

@shubheksha
shubheksha / brackets-pair-colorizer.md
Last active May 1, 2023 18:05
A list of extensions/plugins that highlight matching parens/braces for various editors/IDEs.