Skip to content

Instantly share code, notes, and snippets.

@cellfish
cellfish / good_ioc.cs
Last active August 29, 2015 14:05
Example of good IoC container usage.
class SomeChildObject : IChildObject
{
public SomeChildObject(IMyLowLevelDependency foo)
{
foo.DoSomething();
}
}
class MyObject
{
@cellfish
cellfish / tweet.php
Last active December 31, 2015 16:09
How to post tweets from PHP.
function postTweet($text)
{
$tweet = utf8_encode($text);
$data_array = array('status' => $tweet);
$postfields = http_build_query($data_array);
$url = "https://api.twitter.com/1.1/statuses/update.json";
$oauth_access_token = "PUT YOUR TOKEN HERE";
$oauth_access_token_secret = "PUT YOUR TOKEN SECRET HERE";