Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| var dgram = require('dgram'); | |
| var socket = dgram.createSocket('udp4'); | |
| var testMessage = "[hello world] pid: " + process.pid; | |
| var broadcastAddress = '255.255.255.255'; | |
| var broadcastPort = 5555; | |
| socket.setBroadcast(true); | |
| socket.bind(broadcastPort, '0.0.0.0'); |
| location /resize { | |
| alias /tmp/nginx/resize; | |
| set $width 150; | |
| set $height 100; | |
| set $dimens ""; | |
| if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) { | |
| set $width $1; | |
| set $height $2; | |
| set $image_path $3; |
| # encoding: utf-8 | |
| import sublime, sublime_plugin | |
| class DetectSpecialCharacters(sublime_plugin.EventListener): | |
| def on_load(self, view): | |
| sublime.status_message("detect_special_characters is active") | |
| def on_modified(self, view): | |
| # find no-break space | |
| special_characters = view.find_all(u"\u00A0") |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| http = require('http'); | |
| url = require('url'); | |
| http.createServer(function(req, res){ | |
| var requestURL = url.parse(req.url, true)['pathname']; | |
| if (requestURL == '/log.gif') { | |
| var imgHex = '47494638396101000100800000dbdfef00000021f90401000000002c00000000010001000002024401003b'; | |
| var imgBinary = new Buffer(imgHex, 'hex'); | |
| res.writeHead(200, {'Content-Type': 'image/gif' }); |
| # Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
| # that enables you to choose a character from a menu of options. If you are on Lion | |
| # try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
| # for input. | |
| # | |
| # It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
| # it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
| # as it means you cannot press and hold h/j/k/l to move through your file. You have | |
| # to repeatedly press the keys to navigate. |
| #!/bin/bash | |
| # use AMI ami-04c9306d | |
| # run this script as root. | |
| ## EDIT | |
| export S3_BUCKET="heroku-buildpack-php-tyler" | |
| export LIBMCRYPT_VERSION="2.5.8" | |
| export PHP_VERSION="5.4.1" | |
| export APC_VERSION="3.1.10" | |
| export PHPREDIS_VERSION="2.2.1" |
| mkdir -p /app | |
| # Prepare the filesystem | |
| mkdir -p /tmp/build | |
| cd /tmp/build | |
| # Compiling Apache | |
| curl http://www.us.apache.org/dist/httpd/httpd-2.2.24.tar.gz | tar xzf - |
| #!/bin/bash | |
| # | |
| # This script will make a webcam snapshot every commit. The jpg file will have | |
| # the commit id as the filename. | |
| # | |
| # This script requires imagesnap. Install with: 'brew install imagesnap' | |
| # | |
| # Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by: | |
| # 'chmod +x .git/hooks/post-commit' | |
| # |