Skip to content

Instantly share code, notes, and snippets.

@bearlikelion
bearlikelion / flair.php
Last active December 20, 2015 15:59
reddit.com/r/dota2 flair counter
<?php
$cache = memcache_connect('127.0.0.1', 11211);
$cached = memcache_get($cache, 'flair');
if ($cached == false) {
$account_info = self::reddit_info();
$login = self::reddit_api('login', $account_info);
$after = '';
$complete = 0;
@bearlikelion
bearlikelion / ImageController.php
Created September 27, 2013 16:31
Slothy.me Image Controller
<?php
class ImageController {
protected function selectRandom()
{
if (Cache::has('sloths'))
{
$sloths = Cache::get('sloths');
if (count($sloths) > 1) return $sloths;
else
{
<?php
#!/usr/bin/php
include('ganon.php');
include("config.php");
include("Snoopy.class.php");
include("Googl.class.php");
require("TimeDiff.class.php");
# Constants
define('MAX_MATCHES', 6);
@bearlikelion
bearlikelion / hhvm.hdf
Created April 2, 2014 12:39
Development HHVM config
# hhvm --mode daemon -vServer.Type=fastcgi -vServer.Port=9001 --config /etc/hhvm.hdf
PidFile = /var/run/hhvm.pid
ServerVariables {
ENVIRONMENT = DEVELOPMENT
}
Log {
UseLogFile = true
{
// Plugin settings
// Turn the debug output on/off
"show_debug": true,
// Which file types (file extensions), do you want the plugin to
// execute for
"extensions_to_execute": ["php"],
#siteTable_t3_22trqo a.author[href$="/swired"]:after,
#siteTable_t3_22trqo a.author[href$="/MdK-"]:after,
#siteTable_t3_22trqo a.author[href$="/Bladeofevilsbane"]:after,
#siteTable_t3_22trqo a.author[href$="/Anuxinamoon"]:after,
#siteTable_t3_22trqo a.author[href$="/OniLolz"]:after,
#siteTable_t3_22trqo a.author[href$="/Zaphk"]:after,
#siteTable_t3_22trqo a.author[href$="/prophet9"]:after,
#siteTable_t3_22trqo a.author[href$="/hopgood"]:after,
#siteTable_t3_22trqo a.author[href$="/cottonwings"]:after,
#siteTable_t3_22trqo a.author[href$="/AHelenek"]:after,
@bearlikelion
bearlikelion / st3keys.json
Last active August 29, 2015 13:59
Sublime text keybinds
[
{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+space"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} },
{ "keys": ["ctrl+b"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} },
]
@bearlikelion
bearlikelion / nginx.conf
Created June 3, 2014 15:32
nginx.conf
server {
listen *:80;
server_name mark.dev;
root /home/mark/dev/src/public;
index index.php;
location / {
# rewrite URL to remove trailing forward slash /
rewrite ^/(.*)/$ /$1 permanent;
@bearlikelion
bearlikelion / PSR-Compare.php
Created January 14, 2015 17:25
PSR Standards comparison
<?php
// Current - non-standard code standard we use
public function positions()
{
$resumes = $this->resumes(false, true);
foreach ($resumes as $resume) {
$data = json_decode($resume['data']);
if (isset($data->employment->entries) && count($data->employment->entries) > 0) {
@bearlikelion
bearlikelion / systeminfo.sh
Created January 16, 2015 01:43
Linux system info
uname -a >> systeminfo.txt && lscpu | grep -e Architecture: -e ^CPU\(s\): -e Vendor >> systeminfo.txt && sudo lspci -k | grep VGA -A 3 >> systeminfo.txt && lspci | grep Audio >> systeminfo.txt && cat /proc/meminfo | grep MemTotal >> systeminfo.txt | cat systeminfo.txt