(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/sh | |
for port in $(seq 8000 65000); do echo -ne "\035" | telnet 127.0.0.1 $port > /dev/null 2>&1; [ $? -eq 1 ] && echo "$port" && break; done |
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
<?php | |
class CallMeMaybe | |
{ | |
public function __call($name, $arguments) | |
{ | |
$class = new ReflectionClass($this); | |
$weightedMethods = array(); | |
foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { | |
$methodName = $method->getName(); |
# Easier port forwarding - usage: | |
# | |
# $ portforward project-app1 5432 | |
# | |
# where 'project-app1' is an alias from ~/.ssh/config and 5432 is the remote | |
# port that you want to forward to. | |
function portforward() { | |
HOST=$1 | |
REMOTE_PORT=$2 | |
# Pick a random port and check it is free |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
<?php | |
// Note: CA state law says no robocalls before 9AM, so wait until 12PM EST. | |
$sid = 'Your SID'; | |
$token = 'Your Token'; | |
$telephoneNumber = 'Your Telephone Number, the one that Twilio gives you.'; | |
$client = new Services_Twilio($sid, $token); |
#!/usr/bin/php | |
<?php | |
/** | |
* Because you want "tree", but cannot find the source code quick enough | |
* on the web to compile for OS.X or there is no suitable implementation | |
* on windows. | |
*/ | |
// set error reporting | |
error_reporting(E_STRICT | E_ALL); |