Skip to content

Instantly share code, notes, and snippets.

View cranberyxl's full-sized avatar

Andy Stanberry cranberyxl

  • Lancaster, UK
  • 15:32 (UTC)
View GitHub Profile
@cranberyxl
cranberyxl / git.md
Last active April 28, 2021 13:27
Useful git bash scripts

List remote branches already merged to main

git fetch origin > /dev/null; git checkout origin/main; for branch in $(git branch -a --merged | grep remotes/origin | grep -v main | grep -v 'no branch'| sed -e 's/\s*remotes\///'); do echo "${branch:7}"; done; git checkout main

Delete remote branches already merged to main

git fetch origin > /dev/null; git checkout origin/main; for branch in $(git branch -a --merged | grep remotes/origin | grep -v main | grep -v 'no branch'| sed -e 's/\s*remotes\///'); do git push origin :${branch:7}"; done; git checkout main
@cranberyxl
cranberyxl / desinty-hubot-slack.md
Last active November 3, 2015 16:36
Destiny Hubot for Slack

Destiny Slack Hubot setup

  1. Follow the basic heroku/hubot instructions here: https://gist.github.com/trey/9690729
  2. Add "slack-destiny-bot": "cranberyxl/slack-destiny-bot#search_armory" to package.json to get my fork of the bot with armory search. These will probably make their way back to the original repo eventually.
  3. Go to https://{your-slack-name}.slack.com/services/new/hubot to setup a new hubot integration
  4. Signup for a Bungie API key here: https://www.bungie.net/en/User/API
  5. Plugin the Bungie API key and the slack hubot token into heroku config
$ traceroute www.rr.com
traceroute to www.rr.com (24.28.199.168), 64 hops max, 52 byte packets
1 cpe-24-90-20-1 (24.90.20.1) 62.247 ms 28.031 ms 49.303 ms
2 gig-0-3-0-11-nycmnytf-rtr1.nyc.rr.com (24.29.151.193) 31.817 ms 36.352 ms 47.873 ms
3 bun106.nyquny91-rtr001.nyc.rr.com (184.152.112.99) 18.988 ms 29.686 ms 54.856 ms
4 bun6-nyquny91-rtr002.nyc.rr.com (24.29.148.254) 20.046 ms 23.258 ms 36.638 ms
5 ae-3-0.cr0.nyc20.tbone.rr.com (66.109.6.76) 51.327 ms 34.407 ms 14.770 ms
6 ae-0-0.cr0.nyc30.tbone.rr.com (66.109.6.26) 40.519 ms 81.203 ms 25.858 ms
7 ae-4-0.cr0.dca20.tbone.rr.com (66.109.6.28) 63.897 ms
66.109.9.30 (66.109.9.30) 47.622 ms 36.541 ms
@cranberyxl
cranberyxl / gist:2483417
Created April 24, 2012 20:24
How to download a github private tarball
curl -o {tag}.tgz -Lu "{githubuser}:{githubpassword}" https://github.com/{githubuser}/repo/tarball/{tag}
<?php
class CachedClassMetadata extends ClassMetadata
{
private $filemtime;
public function setFilemtime($filemtime)
{
$this->filemtime = $filemtime;
}
@cranberyxl
cranberyxl / gist:830331
Created February 16, 2011 21:58
Use sessions across client requests
<?php
class YourTestKernel extends \yourKernel
{
protected $session;
protected function initializeContainer()
{
parent::initializeContainer();
<?php
public function testFoo()
{
$order = new Order();
$order->setBillingAddress($this->createAddress('billing'));
$order->setBillingAddress($this->createAddress('shipping'));
}
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.4.tar.gz/from/this/mirror'
homepage 'http://php.net/'
<?php
namespace Symfony\Component\Validator\Constraints;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <[email protected]>
*
* This source file is subject to the MIT license that is bundled
<?php
$filename = "/Andy.jpg";
$min = 800;
list($width, $height) = getimagesize($filename);
$source = imagecreatefromjpeg($filename);
$max = max($height, $width);
if ($min != null && $min > $max) {