Skip to content

Instantly share code, notes, and snippets.

@mattattui
mattattui / gist:879259
Last active July 11, 2017 08:03
Example PHP cURL function
<?php
// See https://lazycat.org/php-curl.html for license & known issues
// P.S. You'd better have a very good reason for using this instead of http://guzzlephp.org/
function httpGet($url, $ttl = 86400)
{
/* Change this or make it an option as appropriate. If you're
* getting urls that shouldn't be visible to the public, put the
* cache folder somewhere it can't be accessed from the web
*/
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@meancode
meancode / asset_insertion.html
Created March 6, 2012 01:56
Asset Insertion template module
<mt:Ignore>Asset Insertion template module</mt:Ignore>
<mt:Ignore>Modified Ken Edwards 03/05/2012 8:30p EST</mt:Ignore>
<mt:Asset id="$asset_id">
<mt:if tag="AssetType" eq="image">
<mt:SetVarBlock name="width" trim="1">
<mt:AssetProperty property="image_width">
</mt:SetVarBlock>
<mt:if name="width" gt="640">
<mt:SetVarBlock name="href"><mt:AssetThumbnailURL width="640" height="640"></mt:SetVarBlock>
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mxml-barmstrong
mxml-barmstrong / console.txt
Created August 25, 2013 04:39
Python Index, IndexBag, Multidex
In [1]: import index
In [2]: i = index.Multidex(unique_keys=('pk',), common_keys=('name',))
In [3]: class Person(object):
def __init__(self, name):
global last_pk
self.pk = last_pk
last_pk += 1
self.name = name
// Playground - noun: a place where people can play
import Cocoa
struct Regex {
let pattern: String
let expressionOptions: NSRegularExpressionOptions
let matchingOptions: NSMatchingOptions
init(pattern: String, expressionOptions: NSRegularExpressionOptions, matchingOptions: NSMatchingOptions) {
@wein3967
wein3967 / DIM Armor Export.js
Last active April 6, 2017 13:18
This is a DIM specific script that is run from the Chrome developer tools console in an active DIM tab
// This is a DIM specific script that can be run in the Developer Console in Chrome on a DIM tab.
// it writes out a csv string with stats and perks for armor, ghosts, and artifacts.
// FUNCTIONS
function isArmor(myItem) {
return (myItem.type === "Helmet" ||
myItem.type === "Gauntlets" ||
myItem.type === "Chest" ||
myItem.type === "Leg" ||
myItem.type === "ClassItem") &&
@wonderbeyond
wonderbeyond / graceful_shutdown_tornado_web_server.py
Last active October 23, 2024 16:13 — forked from mywaiting/graceful_shutdown_tornado_web_server.py
The example to how to shutdown tornado web server gracefully...
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID`,
The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
"""
import time