Skip to content

Instantly share code, notes, and snippets.

View ajtatum's full-sized avatar

AJ Tatum ajtatum

View GitHub Profile
@wasimf
wasimf / Compress
Created September 1, 2013 10:23
CompressionService - .Net Gzip based compression service .
byte[] buffer = Encoding.UTF8.GetBytes(text);
var ms = new MemoryStream();
using (var zip = new GZipStream(ms, CompressionMode.Compress, true))
{
zip.Write(buffer, 0, buffer.Length);
}
ms.Position = 0;
var compressed = new byte[ms.Length];
ms.Read(compressed, 0, compressed.Length);
@nathan-isaac
nathan-isaac / ConEmu.xml
Last active June 12, 2018 19:37
ConEmu Settings
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2014-12-18 08:35:46" build="141216">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data="&quot;%ProgramFiles(x86)%\Git\bin\sh.exe&quot; --login -i"/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Git bash}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
@ajtatum
ajtatum / cloudSettings
Last active August 30, 2021 02:26
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-30T02:26:20.541Z","extensionVersion":"v3.4.3"}
@ajtatum
ajtatum / country-helper.js
Created August 30, 2021 02:27
JavaScript Country Name To Code and Code To Country Name Functions
var countryNameToCode = {
'Afghanistan': 'AF',
'Aland Islands': 'AX',
'Albania': 'AL',
'Algeria': 'DZ',
'American Samoa': 'AS',
'Andorra': 'AD',
'Angola': 'AO',
'Anguilla': 'AI',
'Antarctica': 'AQ',
@jgeiger
jgeiger / nginx.conf
Last active December 24, 2021 06:23
Nginx base config
user www-data;
worker_processes 2;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
use epoll;
}
@adityamenon
adityamenon / app.domainname
Last active December 28, 2021 06:31
My preferred configuration for a Laravel 4 API endpoint running over PHP-FPM, when I need to talk to it with AngularJS.
server {
root /path/to/app/public;
index index.php;
server_name test.dev;
set $cors_headers "whatever-custom-headers,you-would-like";
# redirection to index.php
location / {
try_files $uri $uri/ /index.php?$query_string;
@aaronsteers
aaronsteers / Choco-One-Click.js
Last active April 17, 2022 01:11
Choco install script for TamperMonkey/GreaseMonkey
// ==UserScript==
// @name Choco-One-Click
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description Install software from chocolatey.org with one-click. This requires choco:// protocol support (choco install choco-protocol-support).
// @author AJ Steers
// @include http://*chocolatey.org/*
// @include https://*chocolatey.org/*
// @grant none
// ==/UserScript==
@futtta
futtta / autoptimize_defer_inline_jquery.php
Last active November 11, 2022 21:43
POC to defer inline JS that requires jQuery
<?php
add_action('plugins_loaded','ao_defer_inline_init');
function ao_defer_inline_init() {
if ( get_option('autoptimize_js_include_inline') != 'on' ) {
add_filter('autoptimize_html_after_minify','ao_defer_inline_jquery',10,1);
}
}
function ao_defer_inline_jquery( $in ) {
@sirleech
sirleech / gist:2660189
Created May 11, 2012 14:42
Python Read JSON from HTTP Request of URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']