Skip to content

Instantly share code, notes, and snippets.

Graham Holden opensussex

Block or report user

Report or block opensussex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@opensussex
opensussex / match_stick_factory.ex
Last active Apr 11, 2018
having a go at creating a module to work out the number of boxes are needed for the number of matches past in - this is for the learning functional programming with elixir book
View match_stick_factory.ex
defmodule MatchStickFactory do
def boxes(number_of_matches) do
number_of_matches_in_big = 50;
number_of_matches_in_medium = 20;
number_of_matches_in_small = 5;
number_of_matches_remaining = number_of_matches;
{number_of_big_boxes, number_of_matches_remaining} = divide(number_of_matches_remaining, number_of_matches_in_big)
{number_of_medium_boxes, number_of_matches_remaining} = divide(number_of_matches_remaining, number_of_matches_in_medium)
{number_of_small_boxes, number_of_matches_remaining} = divide(number_of_matches_remaining, number_of_matches_in_small)
@opensussex
opensussex / tax.ex
Created Apr 10, 2018
example of some elixir anonymous function
View tax.ex
apply_tax = fn price -> tax = (price * 0.12); total = price + tax;IO.puts "Price: #{total} - Tax: #{tax}" end;
Enum.each [12.5, 30.99, 250.49, 18.80], apply_tax
View done_done_to_yodiz.php
<?php
$yodiz_columns = [
[
'title'=>'Position',
'from_done_done' =>2
],
[
'title'=>'Id',
'from_done_done'=>2,
@opensussex
opensussex / diff.rb
Created Dec 23, 2016
a very basic example of using the Diffy library to do a diff on two files.
View diff.rb
require ('diffy')
#uses the Diffy library - https://github.com/samg/diffy
file_1, file_2 = ARGV;
file_1_text = open(file_1)
file_2_text = open(file_2)
puts Diffy::Diff.new(file_1_text.read, file_2_text.read)
View TextMarketer.php
<?php
use GuzzleHttp\Client;
class TextMarketer
{
private $username;
private $password;
private $orig;
View packages.txt
atom-php-navigation
autocomplete-elixir
autocomplete-php
git-blame
git-diff-details
git-history
git-time-machine
language-elixir
linter
linter-phpcs
@opensussex
opensussex / Vagrant
Last active Jul 12, 2016
vagrant box.
View Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
View atom xdebug settings (20-xdebug.ini)
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000
xdebug.remote_autostart = 1
xdebug.idekey = "netbeans-xdebug"
xdebug.remote_connect_back=on
@opensussex
opensussex / private.xml
Last active Feb 19, 2016
private.xml for karabiner to swap backquote with backslash needed for wasd keyboard on a mac.
View private.xml
<?xml version="1.0"?>
<root>
<item>
<name>Swap backslash and backquote key.</name>
<identifier>private.backslash_to_backquote</identifier>
<autogen>__KeyToKey__ KeyCode::DANISH_DOLLAR, KeyCode::BACKQUOTE</autogen>
<autogen>__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::DANISH_DOLLAR</autogen>
</item>
View Gruntfile.js
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
You can’t perform that action at this time.