Skip to content

Instantly share code, notes, and snippets.

View akirill0v's full-sized avatar

Alexander Kirillov akirill0v

View GitHub Profile
@mattes
mattes / boot2docker-nfs.rb
Last active December 4, 2023 12:07
docker-machine/ boot2docker with NFS instead of vboxsf
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vvvco) my-machine123
# https://gist.github.com/mattes/4d7f435d759ca2581347
require 'erb'
bootlocalsh = %Q(#/bin/bash
@seeflanigan
seeflanigan / docker-compose.yml
Last active April 18, 2020 07:23
Docker Compose file for running Clojure Koans
koans:
image: clojure
command: lein koan run
volumes:
- ./clojure-koans:/clojure-koans
working_dir: /clojure-koans
repl:
image: clojure
command: lein repl
@solnic
solnic / ar_create.rb
Created March 25, 2015 13:27
ROM/AR "create" operation profiling
require 'active_record'
require 'hotch'
ActiveRecord::Base.establish_connection('postgresql://localhost/rom')
class User < ActiveRecord::Base
end
User.delete_all
@john2x
john2x / 00_destructuring.md
Last active April 10, 2025 15:15
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@mokevnin
mokevnin / game.js
Last active January 1, 2016 18:19
var Game = React.createClass({
getInitialState: function() {
var numbers = _.shuffle(_.range(1, this.props.size * this.props.size));
var table = [];
var thumb_position = {};
for (var x = 0; x < this.props.size; x++) {
table[x] = [];
for (var y = 0; y < this.props.size; y++) {
if (x == this.props.size - 1 && y == this.props.size - 1) {
thumb_position = {"x": x, "y": y};
@aderyabin
aderyabin / skype.sh
Created December 4, 2012 04:24
Save Skype log into Dropbox
mv ~/Library/Application\ Support/Skype ~/Dropbox/
ln -s ~/Dropbox/Skype ~/Library/Application\ Support/Skype
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 15, 2025 08:03
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@nicalpi
nicalpi / facebook_registration.rb
Created September 7, 2011 11:48
Testing Omniauth with Devise, Rspec and Capybara
background do
set_omniauth()
click_link_or_button 'Sign up with Facebook'
end
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end