Skip to content

Instantly share code, notes, and snippets.

View benjaminbarbe's full-sized avatar

Benjamin Barbe benjaminbarbe

View GitHub Profile
module BaseEntity
extend ActiveSupport::Concern
include ActiveModel::Model
include ActiveModel::Dirty
include ActiveModel::Serializers::JSON
include ActiveModel::Serializers::Xml
included do
include ::Virtus.model
@brentkirby
brentkirby / service
Created June 22, 2011 08:50
Unicorn + Runit + RVM
#!/bin/bash -e
#
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls
# to the service and redirect them to unicorn directly.
#
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn.
#
function is_unicorn_alive {
@insin
insin / gulpfile.js
Last active September 15, 2016 08:35
gulpfile for use with React, with flat imports from uniquely-named modules under /src
/*
gulpfile from one of my React applications which has a gulp --production build
set up.
Assumptions:
1. All your own .js/.jsx modules are somewhere under ./src, have unique
filenames and use Node.js-style requires WITHOUT any path information, just
the name of another module somewhere under ./src
@bortels
bortels / launchinstance
Created March 6, 2013 00:44
example script to create AWS ec2 instance using ruby sdk
#!/usr/bin/ruby
require 'rubygems'
require 'aws-sdk'
require 'erb'
aws_email="email address here"
aws_name="My Test Instance"
# below is IAM credentials for my account
@vinoski
vinoski / fd_setsize_on_osx.md
Last active November 7, 2017 06:20
How to raise the maximum number of file descriptors when building Erlang/OTP on OS X.

When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.

First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:

perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in 

Next, when you run configure in your Erlang/OTP source directory, be sure to include the right CFLAGS setting, as shown below:

CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
@pamobo0609
pamobo0609 / FileChooserActivity.java
Created November 1, 2016 15:28
Code capable of opening a file chooser from a Webview in Android
public class AgregarItemActivity extends AppCompatActivity {
Usuario user;
boolean listenerStatus;
String sessionID;
String eventoID;
String agregarItemURL;
String agregarImagenesURL;
String item;
@MoOx
MoOx / gulpfile.js
Last active November 4, 2021 10:19
///
var pkg = require("./package.json")
, rimraf = require("rimraf")
, gulp = require("gulp")
, gutil = require("gulp-util")
, filter = require("gulp-filter")
, plumber = require("gulp-plumber")
, concat = require("gulp-concat")
gulp.task("clean", function() {
@titpetric
titpetric / purge-multi.lua
Created January 8, 2017 18:34
Delete NGINX cached items with a PURGE with wildcard support
-- Tit Petric, Monotek d.o.o., Tue 03 Jan 2017 06:54:56 PM CET
--
-- Delete nginx cached assets with a PURGE request against an endpoint
-- supports extended regular expression PURGE requests (/upload/.*)
--
function file_exists(name)
local f = io.open(name, "r")
if f~=nil then io.close(f) return true else return false end
end
@jonah-williams
jonah-williams / build.sh
Created April 30, 2011 17:46
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html