Skip to content

Instantly share code, notes, and snippets.

View leoallen85's full-sized avatar

Leo Allen leoallen85

  • Makers Academy
  • London, UK
View GitHub Profile
var input = 12345;
input = input.toString();
var solution = reverse([], input.length).join('');
console.log(Number(solution));
function reverse(current, index) {
var string = current.concat(input[index])
if (index == 0) {
git clone https://github.com/makersacademy/unixoid-challenge.git
cd unixoid-challenge/
gem build unixoid-challenge.gemspec
cd ..
gem install cocaine
gem install --local unixoid-challenge/unixoid-challenge-0.1.3.gem
@leoallen85
leoallen85 / meteor_velocity.js
Created November 26, 2014 11:22
Messing around with Velocity tests
describe("Tasks", function() {
beforeEach(function () {
MeteorStubs.install();
mock(global, 'Columns');
});
afterEach(function () {
MeteorStubs.uninstall();
});
@leoallen85
leoallen85 / index.php
Created November 19, 2014 10:51
How to set up Slim with Eloquent ORM
<?php
// Autoload our dependencies with Composer
require '../vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as Capsule;
/**
* Configure the database and boot Eloquent
*/
@leoallen85
leoallen85 / debugging_rails.md
Last active August 29, 2015 14:08
How to debug Rails applications

#Debugging Rails

It is a capital mistake to theorise before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts.

A Scandal in Bohemia, 1892

##Steps for debugging

  1. Hypothesis - read the exception messages properly!
  2. Analysis - think what the program is doing, rather than what it isn't doing. What do you want it to do?
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="you@yourdomain.com"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
@leoallen85
leoallen85 / doubling cube
Created September 11, 2014 09:21
My proof for when you should accept the doubling cube (I need to get a life)
where p is probability of winning the game (using example of doubling to 2, although should work for all examples)
E(V) = 2p - 2(1 - p)
If we refuse the cube, we always lose a point (-1) so we only need to have an E(V) of greater than -1 for it to be worth it
2p - 2 (1 - p) > -1
4p - 2 > -1
p > 1/4
require 'csv'
CSV.foreach("/Users/leo/Downloads/resources.csv") do |row|
puts "<h2><a href=\"#{row[2]}\">#{row[0]}</a></h2>"
puts "<p>#{row[1]}</p>"
end
<h2><a href="http://blog.priceintelligently.com/; http://blog.priceintelligently.com/blog/bid/190815/A-Complete-Guide-to-SaaS-Metrics-and-Your-Pricing-Strategy">Price Optimisation</a></h2>
<p>A very useful blog about (SaaS) pricing - start with the Complete Guide</p>
<h2><a href="http://www.skillshare.com/">Skillshare</a></h2>
<p>Platform to learn (and teach) anything.</p>
<h2><a href="http://www.thehappystartupschool.com/ebook">Build a Happy Startup</a></h2>
<p>E-book guide to building a happy startup</p>
<h2><a href="http://insideintercom.io/how-to-launch-with-a-validated-idea/">Validate Your Idea</a></h2>
<p>How to launch with a validated idea</p>
<h2><a href="http://torquemag.io/starter-themes/">Free Wordpress Themes</a></h2>
<p>10 starter themes and frameworks for Wordpress</p>
[
{ "keys": ["Y"], "command": "clipboard_copy",
"context": [{"key": "clipboardcopy_fake", "operator":"equal", "operand":true}, {"key": "setting.command_mode"}]
},
{ "keys": ["y"], "command": "clipboard_copy",
"context": [{"key": "clipboardcopy_fake", "operator":"equal", "operand":true}, {"key": "setting.command_mode"}]
},
{ "keys": ["D"], "command": "clipboard_copy",
"context": [{"key": "clipboardcopy_fake", "operator":"equal", "operand":true}, {"key": "setting.command_mode"}]
},