Skip to content

Instantly share code, notes, and snippets.

View kulbida's full-sized avatar
🎯
Focusing

Bogdan Kulbida kulbida

🎯
Focusing
View GitHub Profile
@rwjblue
rwjblue / 01_README.md
Last active March 5, 2016 08:26
New Twiddle

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
ArtemGr / system.rs
Last active December 22, 2023 07:08
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;
#[derive(Debug)]
enum PipeError {
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
ngauthier / merge.rb
Created June 25, 2014 14:39
ActiveRecord Scope Merging
# 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
miguelmota / README.md
Last active March 16, 2024 12:52
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

Instructions

Directories and files

~/
@rainerborene
rainerborene / ctrlp.vim
Last active November 22, 2017 13:52
Close buffer via <C-@> using CtrlP
let g:ctrlp_buffer_func = { 'enter': 'CtrlPMappings' }
function! CtrlPMappings()
nnoremap <buffer> <silent> <C-@> :call <sid>DeleteBuffer()<cr>
endfunction
function! s:DeleteBuffer()
let path = fnamemodify(getline('.')[2:], ':p')
let bufn = matchstr(path, '\v\d+\ze\*No Name')
exec "bd" bufn ==# "" ? path : bufn
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@RunnerRick
RunnerRick / .sails-and-passport.md
Last active December 3, 2023 05:01 — forked from theangryangel/AuthController.js
How To Integrate Sails and Passport
@dnagir
dnagir / readme.md
Created November 23, 2012 02:27
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
ngauthier / settimeout.js
Created July 18, 2012 14:35
Daisy-Chaining setTimeout
// 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: