Skip to content

Instantly share code, notes, and snippets.

View Godoy's full-sized avatar

Adriano Godoy Godoy

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')
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@orta
orta / gist:4945269
Last active April 13, 2016 00:35
Get Google Analytics Stats from Hubot
# Artsy Editorial
#
# Get Page stats from google analytics
GA = require('googleanalytics')
util = require('util')
require('date-utils');
module.exports = (robot) ->
robot.hear /stats (.*)http:\/\/artsy.net\/(.*)/i, (msg) ->
@diegogriep
diegogriep / preload-image.js
Last active December 15, 2015 03:59
Preload images
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
// Alternatively you could use:
// (new Image()).src = this;
});
}
// Usage:
@NataliaAvila
NataliaAvila / Rails
Last active June 7, 2016 13:55
Resolvendo problema de SSL em Windows (Rails) - Faraday::Error::ConnectionFailed SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
#Problema com SSL no Rails
- Fazer download do arquivo e salvar no Desktop
https://gist.github.com/fnichol/867550/raw/win_fetch_cacerts.rb
- Abra o Prompt e digite cole codigo abaixo
ruby "%USERPROFILE%\Desktop\win_fetch_cacerts.rb"
- Acesse Variaveis de Ambiente que fica no painel de controle/avançado e clique em novo e insira as informações abaixo e clique em ok apos terminar
Variavel: SSL_CERT_FILE
@tiagobbraga
tiagobbraga / gist:5434895
Created April 22, 2013 13:32
iTunes Integration
// iOS5 Only
- (void) setMediaInfo {
NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
NSString * imName = @"imagetest.png"; // Artwork image
[dict setObject:NSLocalizedString(@"My Music", @"") forKey:MPMediaItemPropertyTitle];
[dict setObject:NSLocalizedString(@"Myself Artist", @"") forKey:MPMediaItemPropertyArtist];
MPMediaItemArtwork * mArt = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:imName]];
[dict setObject:mArt forKey:MPMediaItemPropertyArtwork];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = nil;
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:dict];
@lhap
lhap / TransitionManager.swift
Created January 19, 2015 11:46
Transição Simple Segue
//
// TransitionManager.swift
// Start
//
// Created by Plan B on 12/1/14.
// Copyright (c) 2014 Plan B. All rights reserved.
//
import UIKit
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active October 1, 2024 17:10
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@tomysmile
tomysmile / brew-java-and-jenv.md
Last active September 30, 2024 19:44
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again: