Skip to content

Instantly share code, notes, and snippets.

View JuPlutonic's full-sized avatar
💭
🍺

AMZ JuPlutonic

💭
🍺
  • Msk, Russian Fed.
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@infertux
infertux / mpd-delete-current-song.rb
Created November 5, 2011 19:15
A tiny Ruby wrapper that deletes the song currently played by MPD
#!/usr/bin/env ruby
# Sometimes, you realize you have really rubbish songs in your library for some reason.
# This script allows you to get rid of them just by hitting ./mpd-delete-current-song.rb on your command line.
# It will backup the file to TRASH, then remove it from MPD's library and finally skip to next song.
# https://gist.github.com/1341895
require 'socket'
require 'fileutils'
@ryandotsmith
ryandotsmith / worker-pattern.md
Created January 23, 2012 05:03
The Worker Pattern

The Worker Pattern

Contents

  • Introduction
  • Definition
  • Examples
  • Links

Introduction

@wikimatze
wikimatze / ctags.md
Last active April 7, 2022 23:46
Browsing Padrino's Code Base With Ctags in Vim

Working effectively with ctags has always been a topic I missed for a long time because I was too lazy to invest time to learn about the it.

I was working on on my application and was constantly consulting Padrino's API doc in the browser. It would have been more effective if I can do the searching directly the Padrino's code on GitHub. Benefit I don't have to leave the terminal and can focus on my task.

What is ctags

ctags is a tool which make it easy for you to shift through in no time.

@ingemar
ingemar / params_for.rb
Created September 1, 2013 12:50
A DRY way to deal with strong parameters in Ruby on Rails 4 together with the excellent gem decent_exposure
module ParamsFor
def params_for(model, *attributes)
return if method_defined? "#{model}_params"
define_method "#{model}_params" do
params.require(model).permit attributes
end
end
end
@zealot128
zealot128 / crawler.rb
Last active August 15, 2018 12:22
Web Crawler Helper class based upon Poltergeist (PhantomJS).Using Capybara as framework for building webcrawlers is surprisingly convenient
class ExampleCrawler < PoltergeistCrawler
def crawl
visit "https://news.ycombinator.com/"
click_on "More"
page.evaluate_script("window.location = '/'")
end
end
ExampleCrawler.new.crawl
@mlanett
mlanett / rails http status codes
Last active May 23, 2024 11:36
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@joleuger
joleuger / README_audioclient.md
Last active December 30, 2020 23:00
Audioserver with Pulseaudio and SystemD/LoginD User Lingering (allows bluetooth)

For a tool, which executes a configurable command when a bluetooth device connects, see repository https://github.com/joleuger/bluetooth-manager. It can be used to play an icecast stream.

> apt-get install libpam-systemd
> apt-get install pulseaudio gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-tools mpv
> apt-get install bluetooth bluez bluez-tools bluez-firmware pulseaudio-module-bluetooth 
> adduser audioclient
> vim /etc/shadow (remove password)