Skip to content

Instantly share code, notes, and snippets.

@ballou88
ballou88 / rspec-syntax-cheat-sheet.rb
Created May 27, 2011 18:30 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@kwilczynski
kwilczynski / exists.rb
Created August 21, 2011 11:06
Puppet "exists" function ...
#
# exists.rb
#
# Copyright 2011 Puppet Labs Inc.
# Copyright 2011 Krzysztof Wilczynski
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@fxn
fxn / Action Mailer
Created January 20, 2012 17:20
Ruby on Rails v3.2.0 CHANGELOGs
## Rails 3.2.0 (January 20, 2012) ##
* Upgrade mail version to 2.4.0 *ML*
* Remove Old ActionMailer API *Josh Kalderimis*
@aras-p
aras-p / preprocessor_fun.h
Last active June 21, 2024 12:20
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@opahk
opahk / check threshold and complexity after running tests
Created August 21, 2014 12:41
code coverage build thresholds
bundle exec cane --no-doc --gte "path/to/coverage/covered_percent,99" --lte "path/to/coverage/missed_lines,28"
@opahk
opahk / gist:a2f6f469b11230059315
Created August 21, 2014 12:47
ruby/js testing tools
base
* simplecov
* rspec
* capybara
quality
* checker
* rails_best_practices
* jslint
* coffeelint
@mfrister
mfrister / ruby-flamegraphs.md
Last active August 31, 2015 06:54
Ruby Flamegraphs

ruby-prof Flamegraphs

ruby-prof

require 'ruby-prof'
require 'ruby-prof-flamegraph'
result = RubyProf.profile do

 # code to profile
@mfrister
mfrister / raml-api-console-for-development.md
Last active November 11, 2015 10:36
RAML API Console for Development

Installation

npm install -g http-server

API Console unfortunately is not available on NPM. See its README for installation instructions.

You might have to run grunt after installation. Grunt opens a web page, just close it.

Run:

@ZackStone
ZackStone / slack-invite-all-members-to-a-channel.js
Created April 14, 2017 13:48
Invite all team members to a Slack channel
/*
https://webapps.stackexchange.com/questions/100820/how-do-i-invite-all-team-members-to-a-new-slack-channel#answer-104062
Instructions: Just browse to the appropriate channel and paste
this script (below) into your Chrome/Firefox dev console and hit enter.
Then wait for the script to run until it completes.
It might take time as there is a limit to how many users may be invited at once.
The script will loop until all team members are invited.
*/
var foundAny=false;
function selectAllByLetter(remainingLetters) {
@mostafa-asg
mostafa-asg / Css styles
Last active August 27, 2022 21:05
centering images in Hugo - Based on this article : (http://www.ebadf.net/2016/10/19/centering-images-in-hugo/)
img[src$='#center']
{
display: block;
margin: 0.7rem auto; /* you can replace the vertical '0.7rem' by
whatever floats your boat, but keep the
horizontal 'auto' for this to work */
/* whatever else styles you fancy here */
}
img[src$='#floatleft']