Skip to content

Instantly share code, notes, and snippets.

View andy-berry-dev's full-sized avatar

Andy Berry andy-berry-dev

View GitHub Profile

Keybase proof

I hereby claim:

  • I am andy-berry-dev on github.
  • I am andy_berry_dev (https://keybase.io/andy_berry_dev) on keybase.
  • I have a public key ASAoCcxxK-D2wy-GFDb7LQiRpVSrvDbj-ctFQCNLfz1flgo

To claim this, I am signing this object:

@andy-berry-dev
andy-berry-dev / config.sh
Last active September 3, 2018 20:26 — forked from yoshinari-nomura/ame
Set your status in Slack with CLI & auto update it based on wifi SSID
# save to ~/.config/slackstatus/config.sh
export DEFAULT_TEAM="SomeTeam"
export TOKEN_SOMETEAM="<TOKEN>"
@andy-berry-dev
andy-berry-dev / AbstractModel.php
Last active July 9, 2019 18:52
Changes required to Laravel to allow observing attached/detached events (https://github.com/laravel/framework/pull/14988#issuecomment-267717423)
<?php
use App\Extensions\Relations\BelongsToMany;
abstract class AbstractModel extends Model
{
/*
* This is copied AS IS from \Illuminate\Database\Eloquent\Model@belongsToMany but instead uses our own BelongsToMany class
*/
@andy-berry-dev
andy-berry-dev / README.md
Last active August 26, 2015 21:24
backup script for digital ocean VM

A LAMP server backup script

A script to backup MySQL databases and website data. Backs up all databases to individual gzipped files and each directory in WWW_DATA_DIR to individual gzipped tar archives.

  • backup_env.sh is used to set the neccessary config. This must exist next to the backup script.
  • Use the example here as a starting point.
  • backup.sh is the script itself. Download an execute using ./backup.sh.
  • You're probably using this on a production server. MAKE SURE YOU KNOW WHAT IT WILL EXECUTE!
  • Set DRY_RUN to anything other than 'false' to check what commands will execute.
@andy-berry-dev
andy-berry-dev / index.js
Last active September 18, 2016 13:51
Node script to query the apple stock JSON blob and report which stores have iphone 6 stock
var https = require('https');
var storesUrl = 'https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/stores.json';
var stockUrl = 'https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/availability.json';
var stockLastUpdated;
var stores;
var stock;
*** DURING 100% - other BRJS process (running test server):
2014-07-15 14:04:13
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode):
"Thread-8" prio=5 tid=0x00007fd52c281000 nid=0x6403 runnable [0x0000000118860000]
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:272)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
@andy-berry-dev
andy-berry-dev / test-integration.gradle
Created March 27, 2014 16:33
Config to add a test-integration source set in a Gradle build
if (project.plugins.hasPlugin(JavaPlugin)) {
configurations {
testIntegrationCompile {
extendsFrom testCompile
}
testIntegrationRuntime {
extendsFrom testRuntime
}
}
@andy-berry-dev
andy-berry-dev / index.php
Last active December 28, 2015 14:09
A quick PHP script for Coder Dojo Stirling to find all html files in a `memes` directory on display them in a 'showcase'. Uses iFrames to display each meme so their CSS still takes effect.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<style>
iframe {
width:100%;
height:500px;
@andy-berry-dev
andy-berry-dev / github-sprint-size-calculator
Last active December 27, 2015 01:59
Javascript bookmarklet to calculate sprint sizings for issues on GitHub. Assumes sizes are defined by labels in the format 'size <size>'
javascript:(function(){
var sizeStringPrefix = "size ",
size = 0;
milestoneTitle = "";
jQuery(".issue-milestone .css-truncate-target").each(function() {
var thisMilestone = $(this).text().trim();
if (milestoneTitle.indexOf(thisMilestone) == -1) {
milestoneTitle += " " + thisMilestone;
}