Skip to content

Instantly share code, notes, and snippets.

@joelpittet
joelpittet / composer.json
Last active August 29, 2015 13:57
Example Twig Macro
{
"require": {
"twig/twig": "1.*"
}
}
@sillygwailo
sillygwailo / bash.sh
Last active July 16, 2023 23:09
Beer in my terminal prompt on Fridays
# The following code goes in your ~/.profile
#
# This propmpt shows a beer when you launch a Terminal window on a Fridays.
# It checks every time you get a new prompt. A minute after 11:59M on a
# Thursday, if you press enter, it will add beer to the prompt. A minute
# after 11:59 PM on a Friday, no more beer.
#
# This is for terminals that use the Bash shell, which was the default for
# MacOS previous to Catalina.
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active August 6, 2023 07:32
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@marktheunissen
marktheunissen / htmlfiles_migration.inc.php
Created May 4, 2012 18:32
HTML Files Migration into Drupal using Migrate
<?php
class MyMigration extends Migration {
public $base_dir;
/**
* Constructor.
*/
public function __construct() {
parent::__construct();