Skip to content

Instantly share code, notes, and snippets.

View betacar's full-sized avatar
🤓
Tidsoptimist

Carlos Betancourt Carrero betacar

🤓
Tidsoptimist
View GitHub Profile
@psi
psi / -
Created April 29, 2014 21:02
Colleagues don't let colleagues code sober.
===========
= Spirits =
===========
- Santa Teresa 1796 rum
- Black Maple Hill bourbon
- Bruichladdich Rocks scotch
- Templeton rye
- Whistlepig Straight Rye Whiskey
@modelos = Modelo.all(:params => {:client => @client_code})
@edgar
edgar / git_svn_bash_prompt
Created August 22, 2011 14:46
Set the bash prompt according to: branch/status of the current git/svn repository, rvm/ruby version and gemset used
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git/svn repository
# * the return value of the previous command
# * the current rvm ruby version and gemset (or plain ruby, check parse_ruby_version function)
#
# USAGE:
@daz4126
daz4126 / main.rb
Created July 27, 2011 18:06
Robot Factory part 1 - Adding and Deleting Resources in Sinatra
%w[sinatra dm-core dm-migrations slim sass].each{ |lib| require lib }
DataMapper.setup(:default, ENV['DATABASE_URL'] || File.join("sqlite3://",settings.root, "development.db"))
class Robot
include DataMapper::Resource
property :id, Serial
property :top, Integer, :default => proc { 1+rand(6) }
property :middle, Integer, :default => proc { 1+rand(4) }
property :bottom, Integer, :default => proc { 1+rand(5) }
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}
@toamitkumar
toamitkumar / gist:952211
Created May 2, 2011 19:35
Inspect and test routes on console (Rails 3)
$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}
// write a function that takes an argument
// and returns that argument.
function identity(x) {
return x;
}
// write two binary functions, add and mul,
// that take two numbers and return their sum and product.
@sbolel
sbolel / DCOS-on-Google-Compute-Engine.md
Last active August 6, 2019 02:53
Guide: Set up a DC/OS Mesos cluster on Google Compute Engine

DCOS on Google Compute Engine

Original source: dcos-labs: DCOS on Google Compute Engine

This repository contains scripts to configure a DC/OS cluster on Google Compute Engine.

A bootstrap node is required to run the scripts and to bootstrap the DC/OS cluster.

PLEASE READ THE ENTIRE DOCUMENT. YOU MUST MAKE CHANGES FOR THE SCRIPTS TO WORK IN YOUR GCE ENVIRONMENT.

@lehno
lehno / sqs.mixin.js
Last active October 26, 2019 20:28
SQS Mixin
'use strict';
// Use this produce and consume jobs from AWS SQS as a normal queue list.
// Just add as a mixin and listen to your queues
const { Consumer } = require('sqs-consumer');
const Producer = require('sqs-producer');
const _ = require('lodash');
const AWS = require('aws-sdk');
@byrro
byrro / CREDITS.md
Last active August 18, 2020 16:32
AWS Step Functions Example - Data Migration

CREDITS

This code snippet was extracted from an AWS Step Functions example.

It can ben found in the AWS Console for the Step Functions service.

Follow the instructions on this documentation page

Date: 2019-10-16