Skip to content

Instantly share code, notes, and snippets.

View wyaeld's full-sized avatar
🐣
work in progress

Brad Murray wyaeld

🐣
work in progress
View GitHub Profile
@GeorgeDewar
GeorgeDewar / vpn
Last active October 2, 2016 20:13
#!/bin/bash
red='\e[0;31m'
green='\e[0;32m'
NC='\e[0m'
set -e
function usage {
echo Enable/Disable routing all traffic through VPN, and
@AhmedElSharkasy
AhmedElSharkasy / best_practices
Last active March 17, 2025 21:12
Rails 3 AntiPatterns, Useful snippets and Recommended Refactoring. Note: Some of them are collected from different online resources/posts/blogs with some tweaks.
Rails as it has never been before :)
Rails 3 AntiPatterns, Useful snippets and Recommended Refactoring.
Note: Some of them are collected from different online resources/posts/blogs with some tweaks.

A future version of Ember will come with a new templating engine known as HTMLBars.

The original motivation for HTMLBars was to allow helpers and properties to have better contextual information about what they were bound to.

So for example, consider a template like this:

<a href="{{url}}">{{link}}</a>
@aeons
aeons / PoEDisplay.ahk
Last active March 26, 2016 18:19
Path of Exile item level and DPS calculations, shown in a tooltip. Cleaned up/enchanced version of this script: https://www.pathofexile.com/forum/view-thread/594346
; This script is a cleaned up and enhanced version of the one found here:
; https://www.pathofexile.com/forum/view-thread/594346
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent ; Stay open in background
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
StringCaseSense, On ; Match strings with case.
; Options
; Pixels mouse must move to auto-dismiss tooltip
@jjb
jjb / gist:7389552
Last active December 22, 2024 15:58
Ruby 2.1 memory configuration

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/master/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@pedroaxl
pedroaxl / config_controller.rb
Last active February 28, 2016 05:21
Those are my changes to Sir Trevor Editor Uploader, to allow me to upload the files directly to Amazon S3. It's just an experiment, so it's still a little messy, but it's working.
# As we cant make Secret Access Key open, this method generates a signature that will allow the user to upload this
# file specifically
def sign_s3
bucket_name = 'mailee-images'
original_name = params['file_name']
original_extension = original_name.split('.').last
mime_type = params['file_type']
object_name = Time.now.to_f.to_s.gsub('.','') + '.' + original_extension
#TODO return unless mime_type is valid
@cjbell
cjbell / Gemfile
Created October 21, 2013 21:45
Sir Trevor Image Uploader (Rails + Carrierwave)
# Upload gems
gem "carrierwave"
gem "mini_magick", "~> 3.3"
gem "fog", "~> 1.3.1"
@nofxx
nofxx / logstash.conf
Last active December 24, 2015 13:49
Centralized Ruby/Rails/MongoDB/Redis/Sidekiq/Elasticsearch/Haproxy/PG/OS -> syslog-ng -> logstash -> elasticsearch -> kibana =D
#
# Logstash conf!
#
input {
tcp {
host => "0.0.0.0"
port => 514
type => syslog
}
udp {
@jbenet
jbenet / simple-git-branching-model.md
Last active April 17, 2025 09:30
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@itsderek23
itsderek23 / Dockerfile
Created August 27, 2013 02:09
Example Docker File to start a Rails app located in a local ./docker-rails directory.
# docker build -t="rails" .
FROM ubuntu:12.04
RUN apt-get update
## MYSQL
RUN apt-get install -y -q mysql-client libmysqlclient-dev
## RUBY