Skip to content

Instantly share code, notes, and snippets.

View caiotarifa's full-sized avatar
💻
Coding...

Caio Tarifa caiotarifa

💻
Coding...
View GitHub Profile
@caiotarifa
caiotarifa / application.js
Last active December 23, 2015 16:49
Modernizr.load to asynchronous load Facebook, Twitter and Google+.
Modernizr.load([
{
load: '//platform.twitter.com/widgets.js'
}, {
load: '//apis.google.com/js/plusone.js'
}, {
load: '//connect.facebook.net/en_US/all.js',
complete: function() {
return FB.init({
appId: '482807518397041',
@caiotarifa
caiotarifa / __.js
Last active August 29, 2015 14:09
Simple DOM Selector for Vanilla JS
var __;
__ = function(selector, filter) {
'use strict';
var response;
function filtering(selectors, filter) {
switch (filter) {
case "first":
@caiotarifa
caiotarifa / helper.rb
Last active August 29, 2015 14:18
External and Cacheable use of SVG (with Rails)
def svg_use file, options = {}
content_tag :svg, options do
content_tag :use, nil, :'xlink:href' => asset_path(file)
end
end
@caiotarifa
caiotarifa / application_helper.rb
Last active August 29, 2015 14:18
Helper to insert controller and view name as class in body.
module ApplicationHelper
def page_label
"#{controller_name} #{params[:action].gsub(/_/, " ")}"
end
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@caiotarifa
caiotarifa / _reset.scss
Last active August 29, 2015 14:23
Bye, Normalize.
//***************//
// Reset //
//***************//
:root {
box-sizing: border-box;
cursor: default;
font: 16px/1.5 sans-serif;
text-rendering: optimizeLegibility;
text-size-adjust: 100%;
@caiotarifa
caiotarifa / .scss-lint.yml
Last active August 29, 2015 14:24
My SCSS Lint
linters:
EmptyLineBetweenBlocks:
enabled: true
ignore_single_line_blocks: false
HexLength:
enabled: true
style: long
LeadingZero:
@caiotarifa
caiotarifa / wpcf7_send_to_mailchimp.php
Last active February 11, 2023 17:44
CONTACT FORM 7 -> MAILCHIMP 3.0
<?php
// -------------------------------------------------------------------------- //
// CONTACT FORM 7 -> MAILCHIMP //
// -------------------------------------------------------------------------- //
// © 2015 Caio Tarifa. All Rights Reserved. //
// -------------------------------------------------------------------------- //
function wpcf7_send_to_mailchimp() {
@caiotarifa
caiotarifa / template.js
Created September 2, 2015 19:09
Lightweight JavaScript Templating Engine
var Template = (function (selector) {
'use strict';
function render(data) {
var node = this.node;
if (data) {
for (var variable in data) {
node = node.split('{{' + variable + '}}').join(data[variable]);
}
@caiotarifa
caiotarifa / dispatcher.js
Created September 3, 2015 22:10
Vanilla JavaScript Dispatcher
var Dispatcher = (function() {
'use strict';
var route, namespaceName, controllerName, controller, actionName, action;
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.substring(1);
}
route = $('body').data('route').split('#');