Skip to content

Instantly share code, notes, and snippets.

David Ratajczak mockra

Block or report user

Report or block mockra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gulpfile.js
var gulp = require('gulp');
var concat = require('gulp-concat');
var stylus = require('gulp-stylus');
gulp.task('styles', function() {
gulp.src('./bower_components/bootstrap/dist/css/bootstrap.css')
.pipe(concat('vendor.css'))
.pipe(gulp.dest('./public'))
gulp.src('./assets/**/*.styl')
View gist:10308296
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post, counter_cache: true
end
# Migration
add_column :posts, :comments_count, :integer, default: 0
View gist:10691359
var stripe = require('stripe')('YOUR_API_KEY');
exports.create = function(req, res, next) {
stripe.customers.create(
{ email: user.email, plan: 'YOUR_PLAN_ID', card: req.body.stripeToken },
function(err, customer) {
if (err) return next(err);
user.customerToken = customer.id;
// Save your user, and redirect
}
View gist:10690806
var userSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
customerToken: String
});
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%;
}
input.visa {
background-image: url('visa.png');
}
View gist:ad138b4622925812b641
$ ->
$('input.credit-card').payment('formatCardNumber')
$('input.cvc').payment('formatCardCVC')
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:3b52bf5f95e10771b98b
{{gravatar-image email="test@example.com" size=50}}
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: user.email
fill_in 'session_password', with: user.password
click_button 'Log In'
You can’t perform that action at this time.