Skip to content

Instantly share code, notes, and snippets.

View avsej's full-sized avatar
🛋️
On the couch

Sergey Avseyev avsej

🛋️
On the couch
View GitHub Profile
diff --git i/lib/tasks/db.rake w/lib/tasks/db.rake
index a893c6c..0140f34 100644
--- i/lib/tasks/db.rake
+++ w/lib/tasks/db.rake
@@ -1,10 +1,10 @@
namespace :db do
desc "Dump data from PostgreSQL database"
task dump: :environment do
- config = YAML::load_file(Rails.root.join("config", "database.yml"))[Rails.env]
+ config = ActiveRecord::Base.configurations[Rails.env]
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'avsej')
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :first_name
t.string :last_name
t.string :role
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'avsej')
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :first_name
t.string :last_name
t.string :role
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'test.sqlite3')
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :first_name
t.string :last_name
t.string :role
avsej lcb $ git describe
2.2.0-65-g4b6dee7
avsej lcb $ ./cmake/configure
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
class MyArray < Array
def my_check
if size > 4
:ok
else
:too_small
end
end
def my_compact(use_check)
@avsej
avsej / t.cc
Created December 13, 2013 12:37
#include <libcouchbase/couchbase.h>
#include <iostream>
#include <cassert>
extern "C"
{
static void error_callback(lcb_t, lcb_error_t err, const char*)
{
assert( !"error callback" );
}
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
int ary[] = {1, 2, 3};
@avsej
avsej / Rakefile
Last active December 30, 2015 18:39
task :foo do
print ", "
end
task :foo => [:bar] do
puts "world"
end
task :bar do
print "hello"
Makefile.am | 4 +-
contrib/libvbucket/vbucket.c | 77 +------
example/minimal/minimal.c | 13 +-
include/libcouchbase/arguments.h | 42 ----
include/libcouchbase/cntl.h | 9 +-
include/libcouchbase/types.h | 5 -
include/libvbucket/vbucket.h | 17 --
src/arithmetic.c | 6 +-
src/bconf_io.c | 430 +++++++++++++++++++++++++++++++++++++++
src/bconf_parse.c | 6 +-