Skip to content

Instantly share code, notes, and snippets.

View mcabreradev's full-sized avatar
🎯
Focusing

Miguelángel Cabrera mcabreradev

🎯
Focusing
View GitHub Profile
/**
* App
* =============
*
* */
angular
.module('app.service')
.factory('RestangularCache', ['Restangular', '$cacheFactory', function(Restangular, $cacheFactory) {
return Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setDefaultHttpFields({cache: true});
'use strict';
var cehubClientApp = angular.module('cehubClientApp', [
'ngSanitize',
'ngRoute',
'restangular',
'ui.bootstrap',
'ngTagsInput'
]);
cehubClientApp.config(function($httpProvider) {
@mcabreradev
mcabreradev / Modernizr.js
Created September 1, 2016 13:41
Modernizr.js
<script>
(function($, Modernizr) {
if (!Modernizr.inputtypes.date) {
$('input[type=date]').bootstrapMaterialDatePicker({
format: 'YYYY-MM-DD',
time: false,
lang: 'es'
});
}
@mcabreradev
mcabreradev / export-syntax.js
Created September 23, 2016 20:36 — forked from caridy/export-syntax.js
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@mcabreradev
mcabreradev / image-embed-html.php
Created September 27, 2016 16:08 — forked from jasny/image-embed-html.php
Create base64 encoded image to embed in HTML
<?php
$files = array_slice($argv, 1);
foreach ($files as $file) {
$picture = file_get_contents($file);
$size = getimagesize($file);
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));
@mcabreradev
mcabreradev / SexoController.php
Last active December 22, 2016 15:58
Ejemplo de un CRUD basico
<?php
namespace App\Http\Controllers\Individuos;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Individuos\Sexo;
use Flash;
@mcabreradev
mcabreradev / angularjs_directive_attribute_explanation.md
Created February 23, 2017 17:41 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@mcabreradev
mcabreradev / ng-image-onload.js
Created May 6, 2017 03:36 — forked from kmaida/ng-image-onload.js
AngularJS image onload directive
app.module['myApp'].directive('imageOnload', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('load', function() {
// call the function that was passed
scope.$apply(attrs.imageOnload);
// usage: <img ng-src="src" image-onload="imgLoadedCallback()" />
});
@mcabreradev
mcabreradev / Input.vue
Last active June 2, 2017 17:16
Table.vue
<template>
<div>
<input v-if="field.type === 'text'"
class="form-control"
type="text"
v-bind:id="field.id"
v-model.trim="data[field.name]"
v-bind:name="field.name"
v-bind:placeholder="field.title"
v-bind:required="field.required">
@mcabreradev
mcabreradev / filter.es6.js
Last active October 18, 2018 16:32
Angular filter to vanilla javascript
export const filter = (array, expression, comparator, anyPropertyKey) => {
if (isArrayLike(array)) {
if (array == null) {
return array;
} else {
throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
}
}