Skip to content

Instantly share code, notes, and snippets.

@kinopyo
kinopyo / omniauth_macros.rb
Created November 4, 2011 05:44
Integration test with Omniauth. This example is using twitter, and assume you've installed rspec and capybara. Official document is here: https://github.com/intridea/omniauth/wiki/Integration-Testing
# in spec/support/omniauth_macros.rb
module OmniauthMacros
def mock_auth_hash
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:twitter] = {
'provider' => 'twitter',
'uid' => '123545',
'user_info' => {
'name' => 'mockuser',
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@jeanlescure
jeanlescure / ReactApp.jsx
Created September 30, 2015 10:21
Using Semantic UI Modal in a React.js App
var HelloModal = React.createClass({
getInitialState: function() {
return {
visible: false
};
},
componentDidMount: function() {
var self = this;
$(window).on('modal.visible', function(ev){
self.setState({visible: true});