Skip to content

Instantly share code, notes, and snippets.

View bcambel's full-sized avatar
🌴
On vacation

Bahadir Cambel bcambel

🌴
On vacation
View GitHub Profile
@bcambel
bcambel / mongodb.csharpdriver.save.fail.cs
Created December 22, 2010 10:54
MongoDB C# driver save fails because of duplication exception
using System;
using MongoDB.Bson;
using MongoDB.Bson.DefaultSerializer;
using MongoDB.Bson.IO;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using NUnit.Framework;
namespace ContentFramework.UnitTests.Integration.MongoDb
@bcambel
bcambel / scripts
Created July 15, 2011 10:17
Useful linux and rails dev and server related commands ( Git,Redis,MongoDB,RVM, etc..)
#!/bin/bash
echo "don't freaking run this shell script dude!"
exit 65;
# As a newbie to the unix systems, here are some of the scripts that I use commonly
# down below contains Ruby and related app commands
# the file is going to be a mess soon, I believe :) Enjoy it!
@bcambel
bcambel / redis-server
Created September 19, 2011 11:36 — forked from timols/redis-server
Init.d Redis script for Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@bcambel
bcambel / Capistrano-Deployment-Recipe.rb
Created September 19, 2011 20:27 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@bcambel
bcambel / full.plugin.list.txt
Created October 12, 2011 19:22 — forked from briandoll/full.plugin.list.txt
Full Plugin List Deployed in applications monitored by New Relic, September 2011
Full Plugin List Deployed in Rails applications monitored by New Relic, September 2011
Count Plugin Name
-------------------
2040 rpm
1534 newrelic_rpm
1268 acts_as_list
1186 paperclip
1130 will_paginate
1068 exception_notification
@bcambel
bcambel / crunchbase-api-v1.md
Created November 3, 2011 14:37 — forked from dominicsayers/crunchbase-api-v1.md
CrunchBase API v1

NOTE: This documentation has been put here because I couldn't find it anywhere else. I am not associated with Crunchbase in any way. I cannot help you with your Crunchbase API problems. If you need help try here: https://groups.google.com/forum/#!forum/crunchbase-api

CrunchBase API v1 Documentation

Overview

The CrunchBase API provides JSON representations of the data found on CrunchBase. The API currently supports three actions: "show", "search", and "list", which are each described below.

@bcambel
bcambel / tc_header.json
Created November 6, 2011 23:39
Crawling TechCrunch resulted as the following header
{"SERVER"=>"nginx",
"DATE"=>"Sun, 06 Nov 2011 23:38:49 GMT",
"CONTENT_TYPE"=>"text/html; charset=UTF-8",
"TRANSFER_ENCODING"=>"chunked",
"CONNECTION"=>"close",
"VARY"=>["Accept-Encoding", "Cookie"],
"LAST_MODIFIED"=>"Sun, 06 Nov 2011 23:37:58 +0000",
"CACHE_CONTROL"=>"max-age=249, must-revalidate",
"X_HACKER"=>
"If you're reading this, you should visit automattic.com/jobs and apply to join the fun, mention this header.",
@bcambel
bcambel / README.md
Created November 10, 2011 10:45 — forked from mloughran/README.md

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

# coding:utf-8
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'rubygems'
require 'active_record'
require 'em-mysqlplus'
require 'em-synchrony'
require 'em-activerecord'
db_config = YAML.load_file(File.join(File.dirname(__FILE__), 'config', 'database.yml'))
@bcambel
bcambel / mongo_pubsub.rb
Created November 16, 2011 14:08 — forked from octplane/mongo_pubsub.rb
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)