Skip to content

Instantly share code, notes, and snippets.

View jponc's full-sized avatar
🏖️

Julian Ponce jponc

🏖️
  • Serenade
  • Sydney, Australia
View GitHub Profile
@jponc
jponc / docker-machine-mac-osx.md
Created April 30, 2019 06:02 — forked from Integralist/docker-machine-mac-osx.md
Docker Machine on Mac OS X

VirtualBox

  • https://www.docker.com/toolbox
  • docker-machine create --driver virtualbox dev
  • docker-machine env dev (add values to ~/.zshrc)
    • e.g. echo eval "$(docker-machine env dev)" >> ~/.zshrc
  • docker-machine ls
  • docker ps (might need to re-source .zshrc file; e.g. . ~/.zshrc)
  • docker run hello-world
  • docker-machine ip dev
@jponc
jponc / index.js
Created July 22, 2017 15:39
Can't identify userLogin action :(
import React, { Component } from 'react'
import { Field, reduxForm } from 'redux-form'
import { userLogin } from '../../actions'
import './index.css'
class Login extends Component {
componentWillMount (){
document.body.classList.add('login');
@jponc
jponc / .tmux.conf
Created March 30, 2016 00:49
Personal Tmux Conf
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
@jponc
jponc / service_object_example.rb
Last active December 28, 2015 02:22
Service Object Example
class Invoice
def process_payment
# In this manner, it abstracts the logic of payment processing to the service object
InvoiceServices::Payment.new(self).process
end
end
class Tracker
def self.track
# Do tracking stuff here
@jponc
jponc / schema.xml
Created July 29, 2015 03:48
Solr configuration
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@jponc
jponc / active_record_mongoid_bridge.rb
Created May 18, 2015 11:53
Creating basic association between ActiveRecord models and Mongoid documents
# Original source: http://hashrocket.com/blog/posts/bridging-activerecord-and-mongoid
class ActiveRecord::Base
def self.has_many_documents(association_name)
class_eval %<
def #{association_name}
#{association_name.to_s.singularize.classify}.where(#{name.underscore}_id: id)
end
>
end
@jponc
jponc / blackjack.c
Created November 4, 2014 13:46
BlackJack Game for my youngest brother lol
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SUIT_MAX_VAL 4
#define NUM_MAX_VAL 13
#define BLACK_JACK_NUM 21
char deck[4][13];
@jponc
jponc / gist:329d0b28dd187ac783e2
Created October 2, 2014 01:20
Rubocop sublime settings rbenv
{
// Here you can provide your own command line
// which is used to run rubocop. The path will be
// replaced by the file or folder which needs
// to be checked.
//
// If check_for_rvm or check_for_rbenv is enabled,
// it will be prefixed with a call to rvm or rbenv.
// If none of them are enabled, the command will be
// executed without any additions.
{
"erb_verify_command": "erb -xT - {file_name} | ruby -c",
"ruby_verify_command": "ruby -c {file_name}",
"run_ruby_unit_command": "ruby -Itest {relative_path}",
"run_single_ruby_unit_command": "ruby -Itest {relative_path} -n '{test_name}'",
"run_cucumber_command": "zeus cucumber {relative_path} --no-color",
"run_single_cucumber_command": "zeus cucumber {relative_path}:{line_number} --no-color",