Skip to content

Instantly share code, notes, and snippets.

=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')
@lustremedia
lustremedia / PagesController.rb
Last active August 29, 2015 14:01
render/redirect_to with flash messages and validation errors in rails 4
class PagesController < ApplicationController
def contact
if request.post? #POST
logger.info("I am a POST")
@entrant=Entrant.new(entrant_params)
@event = Event.find(1)
$('.jp-volume-bar').mousedown(function() {
var parentOffset = $(this).offset(),
width = $(this).width();
$(window).mousemove(function(e) {
var x = e.pageX - parentOffset.left,
volume = x/width
if (volume > 1) {
$("#JPID").jPlayer("volume", 1);
} else if (volume <= 0) {
$("#JPID").jPlayer("mute");
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
/* lazyload.js (c) Lorenzo Giuliani
* MIT License (http://www.opensource.org/licenses/mit-license.html)
*
* expects a list of:
* `<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy">`
*/
!function(window){
var $q = function(q, res){
if (document.querySelectorAll) {
@lustremedia
lustremedia / jquery plugin starter
Last active June 17, 2023 13:28
jquery plugin starter
// jQuery Plugin Boilerplate
// A boilerplate for jumpstarting jQuery plugins development
// version 1.1, May 14th, 2011
// by Stefan Gabos
// remember to change every instance of "pluginName" to the name of your plugin!
(function($) {
// here we go!
$.pluginName = function(element, options) {
[alias]
co = checkout
br = branch
ci = commit
st = status
deploytag = "!git tag deploy-`date \"+%Y%m%d%H%M\"` && git push --tags"
switch = !legit switch \"$@\"
branches = !legit branches
sprout = !legit sprout \"$@\"
unpublish = !legit unpublish \"$@\"
var vol = 20;
var t = 0;
function playSample(id) {
$("#player").stop();
vol = 20;
stopSample();
$("#player").setFile("yourfile.mp3");
fadeIn();
@lustremedia
lustremedia / tint2-default-cb
Created January 21, 2014 20:33
Default tint2 config from CrunchBang Waldorf
#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------
# For more information about tint2, see:
# http://code.google.com/p/tint2/wiki/Welcome
#
# For more config file examples, see:
# http://crunchbanglinux.org/forums/topic/3232/my-tint2-config/
# Background definitions
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev