This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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") && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |