Skip to content

Instantly share code, notes, and snippets.

View kivanio's full-sized avatar
🏠
Working from home

Kivanio Barbosa kivanio

🏠
Working from home
View GitHub Profile

Rails tips

Session count

f = ActiveRecord::Base.connection.execute("SELECT COUNT(id) FROM db_sessions")
f.each { |ff| p ff }

Recreate schema_migrations table

'use strict';
var request = require('request');
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@kivanio
kivanio / Gemfile
Created February 7, 2014 11:00 — forked from flomotlik/Gemfile
gem 'foreman'
gem 'puma'
@kivanio
kivanio / puma.rb
Created February 7, 2014 11:38 — forked from catsby/puma.rb
preload_app!
min_threads = Integer(ENV['MIN_THREADS'] || 0)
max_threads = Integer(ENV['MAX_THREADS'] || 5)
threads min_threads, max_threads
workers Integer(ENV['WORKER_COUNT'] || 3 )
on_worker_boot do
ActiveSupport.on_load(:active_record) do
require 'savon'
module Foobarservice
class Client
attr_accessor :wsdl, :user_id, :token
def initialize(attrs = {})
attrs.each do |k,v| send("#{k}=", v) end
@client = Savon.client(wsdl: @wsdl) do
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
var yourApp = angular.module('yourApp', []);
// fix 1
$(document).on('ready page:load', function(){
angular.bootstrap(document.body, ['yourApp']);
});
// or
@kivanio
kivanio / .rspec
Created February 13, 2014 21:27 — forked from coreyhaines/.rspec
--colour
-I app
@kivanio
kivanio / Gemfile
Created February 14, 2014 13:50 — forked from adamrobbie/Gemfile
gem 'will_paginate'