Skip to content

Instantly share code, notes, and snippets.

View alexanmtz's full-sized avatar
🎯
Focusing

Alexandre Magno alexanmtz

🎯
Focusing
View GitHub Profile
@alexanmtz
alexanmtz / validate_maior_que_dezoito.js
Created July 11, 2012 03:03
Novo método do validate
// Metodo para validar se a pessoa tem mais de 18 anos, ela serve para ilustrar como usar o addMethod para criar qualquer regra de validação
jQuery.validator.addMethod("minAge", function(value, element, params) {
return this.optional(element) || value > params;
}, "Você precisa ter mais de 18 anos.");
@alexanmtz
alexanmtz / jquery_basic_plugin.js
Created July 24, 2012 00:31
A basic jQuery plugin file
;(function ( $, window, document, undefined ) {
// Create the defaults once
var pluginName = 'defaultPluginName',
defaults = {
propertyName: "value"
};
// The actual plugin constructor
function Plugin( element, options ) {
@alexanmtz
alexanmtz / wordpress-plugin-svn-to-git.md
Last active June 16, 2016 01:57 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@alexanmtz
alexanmtz / layout-sidebar-adapt.scss
Created February 5, 2017 16:43
Example of a navigation in two columns adapted to a mobile overlay vertical navigation
@media screen and (max-width: 480px) {
html {
.main {
width: 100%;
}
.trigger-overlay-container {
display: block;
}
.sidebar .close {
display: block;
@alexanmtz
alexanmtz / overlay.js
Created February 5, 2017 16:57
Overlay navigation with javascript
(function() {
var triggerBttn = document.getElementById( 'js-trigger-overlay' ),
overlay = document.querySelector( 'div.overlay' ),
body = document.querySelector( 'body' );
var transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd',
'transition': 'transitionend'
@alexanmtz
alexanmtz / flex-navigation.scss
Created February 5, 2017 17:02
Flex navigation
/*
* Mobile styles
*
*/
@media screen and (max-width: 1000px) {
html {
&.no-scroll {
overflow: hidden;
}
@alexanmtz
alexanmtz / overlay.scss
Created February 5, 2017 17:05
Overlay with CSS animations
@media screen and (max-width: 480px) {
html {
/*
* Overlay effect
*
*/
.overlay{
position:fixed;
width:100%;
height:100%;
@alexanmtz
alexanmtz / plaid+managed.md
Created February 10, 2017 13:51 — forked from matthewarkin/plaid+managed.md
Plaid and Managed Accounts

Ensuring Valid External Accounts with Stripe and Plaid

When adding a bank account to a customer in Stripe, Stripe forces you to verify the bank account (either through microdeposits or through Plaid. This is useful because you don't want to withdraw money from a bank account that a user does not own. However when it comes to sending money to bank accounts, Stripe does not require you to verify the account. After all why would you send money to an account that you're not in control of. But lets face it, users make mistakes and its not uncommon for them to type their routing or account number which can significantly delay their transfers.

One way to prevent this is to get their routing and account number directly from their bank and avoid the possibility of user error. This is where Plaid comes in. Plaid provides instant ACH verification by having the user log into their bank account (similiar to what you may done if you've ever used Mint). The u

@alexanmtz
alexanmtz / order_pay.rb
Last active February 21, 2017 14:36
Paying a order with application fee and connected account on stripe
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
Stripe::Order.create(
:currency => 'usd',
:email => 'jenny@example.com',
:items => [
{
:type => 'sku',

Integrating Stripe with Rails (Concise)

This written tutorial is a concise version of this tutorial, which covers building a payment system into a Rails app using Stripe.js. It assumes a basic familiarity with Ruby on Rails, Git and the command-line.

What's covered

  • Setting up a basic Rails app with a scaffold generator
  • Integrating Stripe charges
  • Deploying to Heroku