Skip to content

Instantly share code, notes, and snippets.

@barmmie
barmmie / addsite.sh
Last active November 11, 2019 21:43 — forked from Tmeister/nginx.conf
Laravel Server Setup
read -p "Write the host name, eg. google:" HOST;
read -p "Write the 1st level domain name without starting dot (.), eg. com.au:" DOMAIN;
mkdir -p /var/www/$HOST.$DOMAIN/current/public
mkdir -p /var/www/$HOST.$DOMAIN/logs
mkdir -p /var/www/$HOST.$DOMAIN/ssl
mkdir /etc/nginx/sites-available/
touch /etc/nginx/sites-available/$HOST.$DOMAIN
@barmmie
barmmie / test-controllers.sh
Created July 22, 2019 20:39 — forked from jasonmccreary/test-controllers.sh
One-line shell script to generate HTTP Tests for your application's controllers.
# Run `artisan make:test` for all Controllers under `your app/Http/Controllers` folder.
# Created tests mirror their path under the `app` folder and are suffixed with "Test".
find app/Http/Controllers -type f -name '*Controller.php' -exec sh -c 'php artisan make:test $(dirname "${1:4}")/$(basename "$1" .php)Test' sh {} \;
//Add this to Your serviceprovider.php

Browser::macro('fillHidden', function ($name , $value) {
    $this->script("document.getElementsByName('$name')[0].value = '$value'");
    return $this;
});
@barmmie
barmmie / _message.html.erb
Created June 27, 2017 19:42 — forked from Joseph-N/_message.html.erb
Tutorial code snippets for chat application in rails. Tutorial link http://goo.gl/l3e8zN
<li class="<%= self_or_other(message) %>">
<div class="avatar">
<img src="http://placehold.it/50x50" />
</div>
<div class="chatboxmessagecontent">
<p><%= message.body %></p>
<time datetime="<%= message.created_at %>" title="<%= message.created_at.strftime("%d %b %Y at %I:%M%p") %>">
<%= message_interlocutor(message).name %> • <%= message.created_at.strftime("%H:%M %p") %>
</time>
</div>
Trying to bootstrap Dokku on an OpenStack Mitaka instance doesn't work. The reason is that this command fails:
docker build -t gliderlabs/herokuish /var/lib/herokuish
The curl to an HTTPS URL times out. This is because of a change in Docker where it no longer uses the MTU from the host, as described here.
The fix I found is to then go in to where your $DOCKER_OPTS are passed in and add in the MTU of your OpenStack installation (from ifconfig, generally 1450 seems like the right value) using the format -mtu=1450. For example on Ubuntu 16.04 the file to edit is /lib/systemd/system/docker.service and it should look like this:
ExecStart=/usr/bin/dockerd -H fd:// -mtu=1450
My proposed solution is to somehow pass $DOCKER_OPTS in to bootstrap.sh, that way we can also customise the --dns flag so it uses OpenStack's DNS servers not Google's. I don't know how you'd want to do this given that bootstrap.sh supports multiple distributions and each has a different way of configuring docker to start though.
.dont-break-out {
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
@barmmie
barmmie / GoogleParser.js
Created July 22, 2015 23:02
Easily parse results from google address autocomplete
// Ex. GoogleParser.getCity(place); -Where place is a google place object returned from autocomplete
var GoogleParser = {
getStreetNumber: function (place) {
var COMPONENT_TEMPLATE = {street_number: 'short_name'},
streetNumber = this.getAddrComponent(place, COMPONENT_TEMPLATE);
return streetNumber;
},
a.item:after, button.item:after, .item[href] .item-content:after, .item[ng-click] .item-content:after {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
@barmmie
barmmie / gist:3b71786b48dd3b5043de
Created January 7, 2015 22:18
Padding And Margin Css Helper
.m-xs {
margin: 5px;
}
.m-sm {
margin: 10px;
}
.m {
margin: 15px;
}
<?php
// app/start/global.php
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which