Skip to content

Instantly share code, notes, and snippets.

@naps62
naps62 / foobar.conf
Last active August 29, 2015 14:07
Examples for Provision talk @ Code Week
upstream foobar {
server unix:///var/www/foobar/shared/sockets/puma.sock;
}
server {
server_name www.foobar.com;
return 301 $scheme://foobar.com$request_uri;
}
server {
@naps62
naps62 / .rubocop.yml
Created March 22, 2015 22:36
[ESS @ UM] Rubocop setup
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'bin/**/*'
- 'vendor/**/*'
language: ruby
rvm:
- 2.0.0
@naps62
naps62 / components.js
Created April 9, 2015 00:08
A JS component pattern implementation
var GameObject = function(name) {
this.name = name || "gameObject";
this.components = [];
}
GameObject.prototype.update = function() {
this.components.map(function(component) {
if (!!component.update) {
component.update();
}
@naps62
naps62 / cs2015-rails-presentation.md
Last active August 29, 2015 14:26
cs2015-rails-presentation

Topics

  • MVC
  • Routes
  • Convention over Configuration
  • How to create a Rails project
  • Directory Structure
  • Route helpers
  • (*) sprockets (manifest files, minification, etc, Scss)
  • (*) views (view helpers
@naps62
naps62 / bitly.rb
Last active December 16, 2015 18:00
Ruby script to quickly shorten a url using the bit.ly API. The only requirements are the bitly and clipboard gems, and BITLY_USERNAME and BITLY_API_KEY environment variables
#!/usr/bin/env ruby
require 'bitly'
require 'clipboard'
require 'uri'
username = ENV['BITLY_USERNAME']
api_key = ENV['BITLY_API_KEY']
url = ARGV.shift
@naps62
naps62 / 01_goal.rb
Last active December 27, 2015 13:29
possible approach to presenter pattern (not tested)
# We want to have something this:
# app/models/user.rb
class User < ActiveRecord::Base
include Presenter::Mixin
end
# or for more customization
class User < ActiveRecord::Base
presented
@naps62
naps62 / test.rb
Last active February 26, 2016 10:23
egonSchiele/contracts.ruby - issue #229
require "contracts"
C = Contracts
module ModuleWithContracts
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
@naps62
naps62 / live-coding.sh
Last active October 7, 2016 13:37
screenkey setup for live coding display of key presses
#!/bin/sh
# grab screen width and height
resolution=$(xrandr | grep '*' | head -n1 | tr -s ' ' | cut -d ' ' -f2)
resolution_width=$(echo $resolution | cut -d 'x' -f1)
resolution_height=$(echo $resolution | cut -d 'x' -f2)
# overlay will have full width, 80px height
width=$resolution_width
height=80
@naps62
naps62 / Github Reviews' Review.md
Last active November 6, 2016 14:44
Feedback from my current experience with the new Github Reviews feature

Overall, I like the path where this is headed, but I have some big concerns with the current functionality. here's a quick list:

There's no easy & quick way for me to tell what's left for me to review

See the screenshot below, taken a couple of days ago:

Pull Requests

This is a list of open PRs on a client project. Some were already reviewed by me, other's weren't. For the ones I haven't reviewed, the green check mark also shows up, because our CI was green. There was no way for me to tell which ones I still haven't reviewed without opening each one individually.