Skip to content

Instantly share code, notes, and snippets.

View john-crossley's full-sized avatar
🥔

John Crossley john-crossley

🥔
  • John Crossley
  • Manchester, England
View GitHub Profile
@john-crossley
john-crossley / FizzBuzz.rb
Last active December 21, 2015 15:29
Just a random FizzBuzz example written in Ruby
#!/usr/bin/ruby
i = 1
num = rand(100..1000)
until i > num do
if i % 3 == 0 and i % 5 == 0
puts "FizzBuzz"
elsif i % 3 == 0
@john-crossley
john-crossley / FizzBuzz.php
Created August 24, 2013 09:21
FizzBuzz in PHP
<?php
$i = 1;
$num = mt_rand(100, 1000);
while ($i < $num) {
if ($i % 3 == 0 && $i & 5 == 0) {
echo "FizzBuzz\n";
} else if ($i % 3 == 0) {
@john-crossley
john-crossley / Preferences.sublime-settings
Last active December 21, 2015 21:38
My sublime text config.
{
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"create_window_at_startup": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_shadows": true,
"draw_white_space": "all",
@john-crossley
john-crossley / .zshrc
Last active December 23, 2015 15:49
My zshrc more or less taken from some other guy (can't remember who)
#########
# COLORS
#########
autoload -U colors
colors
setopt prompt_subst
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
@john-crossley
john-crossley / Vagrantfile
Last active December 30, 2015 14:09
My default vagrant setup script
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
@john-crossley
john-crossley / gist:e207dd48f67f5dd8579a
Created January 9, 2015 20:02
Default (OSX).sublime-keymap
[
{ "keys": ["super+alt+n"], "command": "advanced_new_file_new"},
{ "keys": ["shift+super+alt+n"], "command": "advanced_new_file_new", "args": {"is_python": true}},
{
"keys": ["tab"],
"command": "insert",
"args": {"characters": "\t"},
"context": [{
"key": "setting.anf_panel"
}]
# Set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
"*":
"exception-reporting":
userId: "b9774f41-06f4-caa6-793d-fdf6850e45e2"
welcome:
showOnStartup: false
core:
disabledPackages: [
"jshint"
]
editor:
@john-crossley
john-crossley / expand-collapse.java
Last active August 29, 2015 14:26 — forked from ZkHaider/expand-collapse.java
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {
super(v);
v.setOnClickListener(this);
package jonnothebonno.me.veggiebeers.events
interface EventDispatchObserver {
fun didReceiveEvent(event: EventType)
}