Skip to content

Instantly share code, notes, and snippets.

View lucasconstantino's full-sized avatar
❄️
Working from the cold

Lucas Constantino Silva lucasconstantino

❄️
Working from the cold
View GitHub Profile
@lucasconstantino
lucasconstantino / SassMeister-input-HTML.html
Created November 27, 2013 06:13
Generated by SassMeister.com.
<h2>Teste</h2>
@lucasconstantino
lucasconstantino / script-loader.js
Last active January 2, 2016 15:39 — forked from jonathanstark/adding-js-programmatically.html
A simple function with no dependencies to load external javascripts. Features include:- Loading multiple scripts at once;- Callback function to execute once all scripts have loaded;- Optionally load scripts asynchronously;- Optionally define a DOM object where scripts will be inserted.
/**
* Snippet function to load external scripts.
* @param {[String, Array]} sources Array of sources to load.
* @param {[Functon]} callback A callback to run when all scripts have loaded.
* @param {[Boolean]} aasync Whether sources should be loaded
* asynchronously or not.
* @param {[Object]} appendTo Optionally provide a DOM object to append
* the script tags to.
*/
function scriptLoader(sources, callback, async, appendTo) {
@lucasconstantino
lucasconstantino / SassMeister-input.sass
Created January 13, 2014 15:41
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
// ERRADO!
.exemplo-1-c .exemplo-1-a
color: blue
angular.module('app', []).directive('ngDebounce', function($timeout) {
return {
restrict: 'A',
require: 'ngModel',
priority: 99,
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input');
@lucasconstantino
lucasconstantino / hook_ctools_plugin_directory.php
Created May 6, 2014 18:50
A generic hook_ctools_plugin_directory implementation.
<?php
/**
* Implements hook_ctools_plugin_directory().
*/
function hook_ctools_plugin_directory($owner, $plugin_type) {
$plugin_map = array(
// Set the directory map as the key to the following 'owner' => 'plugin_type' combinations.
@lucasconstantino
lucasconstantino / bootstrap-file-input-directive.js
Last active August 29, 2015 14:02
AngularJS directive wrapper over bootstrap-file-input from grevory
/**
* Bootstrap File Input directive wrapper.
*/
angular.module('bfi', [])
.directive('bfi', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.bootstrapFileInput();
}
@lucasconstantino
lucasconstantino / Teste pro Kaue
Created July 17, 2014 02:13
Teste de Resolução para o Kaue
// Antes.
recipients: function(RecipientsService) {
return RecipientsService.getRecipients();
}
// Depois (para testar).
recipients: function(RecipientsService) {
var promise = RecipientsService.getRecipients();
promise.then(
@lucasconstantino
lucasconstantino / app.js
Created July 17, 2014 06:19
Sample modularization in Angular applications.
/**
* ------------------------------------------------------------------------
* Main Application Module (app.js)
* ------------------------------------------------------------------------
* This script is responsible for instantiating the main application
* angular module and grabbing everything together.
*/
angular.module('MyApp', [
// Contributed modules.
@lucasconstantino
lucasconstantino / beforeAll.helper.js
Last active March 14, 2016 18:48
Helper method to simulate beforeAll behavior for tests using protractor.
/**
* @file
* Protractor beforeAll implementation as helper.
*/
var history = [];
/**
* BeforeAll implementation.
*/
/**
* Jus' encapsulating to avoid pluting global scope.
*/
(function () {
var kolorContainer = document.querySelector('#kolor-kolor')
, buttons = document.querySelectorAll('#kolor-start, #kolor-restart')
, endBlock = document.querySelector('#kolor-end-block')
, interval;