Skip to content

Instantly share code, notes, and snippets.

David Ratajczak mockra

View GitHub Profile
View logging_in_spec.rb
require 'spec_helper'
feature 'logging in' do
let(:user) { create :user }
scenario 'with correct credentials' do
visit login_path
fill_in 'session_email', with:
fill_in 'session_password', with: user.password
click_button 'Log In'
View gist:3b52bf5f95e10771b98b
{{gravatar-image email="" size=50}}
View gravatar-image.js
import Ember from 'ember';
export default Ember.Component.extend({
size: 200,
email: '',
gravatarUrl: function() {
var email = this.get('email'),
size = this.get('size');
View gist:663d09b6ba58f84a7a32
.credit-card {
padding: 7px 40px 7px 7px;
background: #FFF url('generic.png') 97% 50% no-repeat;
background-size: 25px 25px;
width: 100%;
} {
background-image: url('visa.png');
View gist:ad138b4622925812b641
$ ->
View gist:10691359
var stripe = require('stripe')('YOUR_API_KEY');
exports.create = function(req, res, next) {
{ email:, plan: 'YOUR_PLAN_ID', card: req.body.stripeToken },
function(err, customer) {
if (err) return next(err);
user.customerToken =;
// Save your user, and redirect
View gist:10690806
var userSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
customerToken: String
View gist:10308296
class Post < ActiveRecord::Base
has_many :comments
class Comment < ActiveRecord::Base
belongs_to :post, counter_cache: true
# Migration
add_column :posts, :comments_count, :integer, default: 0
mockra / nginx
Last active May 6, 2020
nginx config for static site
View nginx
server {
listen 80;
root /var/www/;
index index.html index.htm;
location / {
default_type "text/html";
You can’t perform that action at this time.