Skip to content

Instantly share code, notes, and snippets.


Bogdan Kulbida kulbida

View GitHub Profile

Demo using dynamic attributeBindings to enable auto-attribute bindings without having to know all possible combinations.

Note this is using a simplified version of {{one-way-input}} (part of the ember-one-way-controls addon).

ArtemGr /
Last active Mar 13, 2020
Read lines from a pipe as soon as they come out (useful for filtering).
#![feature(mpsc_select, box_syntax)]
use std::io;
use std::process::Command;
use std::sync::mpsc::{channel, Receiver, Select};
use std::string::FromUtf8Error;
use std::thread::spawn;
enum PipeError {
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
ngauthier / merge.rb
Created Jun 25, 2014
ActiveRecord Scope Merging
View merge.rb
# Merging Scopes
# ==============
# The goal is to join two tables to get all the records where a scope on both
# side of the join is used. I used to do this with a `where()` in which I
# added some sql on the joined table. But, I wanted to use the existing scopes
# from the joining table. Turns out there's a `merge` method on a scope where
# you can merge with another scope without having to chain!
class Car < ActiveRecord::Base
has_and_belongs_to_many :people
miguelmota /
Last active Dec 27, 2020
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg


Directories and files

rainerborene / ctrlp.vim
Last active Nov 22, 2017
Close buffer via <C-@> using CtrlP
View ctrlp.vim
let g:ctrlp_buffer_func = { 'enter': 'CtrlPMappings' }
function! CtrlPMappings()
nnoremap <buffer> <silent> <C-@> :call <sid>DeleteBuffer()<cr>
function! s:DeleteBuffer()
let path = fnamemodify(getline('.')[2:], ':p')
let bufn = matchstr(path, '\v\d+\ze\*No Name')
exec "bd" bufn ==# "" ? path : bufn
plentz / nginx.conf
Last active Jan 18, 2021
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
RunnerRick /
Last active May 4, 2020 — forked from theangryangel/AuthController.js
How To Integrate Sails and Passport
dnagir /
Created Nov 23, 2012
Unobtrusive and testable AJAX in Rails 3

The problem

Initially asked at RORO but I will elaborate with an example.

What we need to do is the following:

  • we list a set of items (let's say posts) and want to show a drop-down menu next to each one (quick example)
  • when the drop-down arrow is clicked the menu is loaded from the server.
ngauthier / settimeout.js
Created Jul 18, 2012
Daisy-Chaining setTimeout
View settimeout.js
// if we have
function do() {
// thing that takes 100ms - 2s depending on browser
// Instead of:
setInterval(do, 500) // pray it doesn't lock the browser
// Do this:
You can’t perform that action at this time.