Skip to content

Instantly share code, notes, and snippets.

View bayareawebpro's full-sized avatar
✔️
Available for Consulting

Dan Alvidrez bayareawebpro

✔️
Available for Consulting
View GitHub Profile
//Source: https://addyosmani.com/blog/essential-js-namespacing/
var myApp = myApp || {};
myApp.utils = {};
(function() {
var val = 5;
this.getValue = function() {
/** Tutorial: https://medium.com/@danielalvidrez/adding-es6-promises-to-animate-css-869156ec0cbd **/
$(document).ready(function(){
/** Add Support for Animate.css ES6 Promises **/
$.fn.extend({
animateCss: function (animationName, duration = 1.0, delay = 0) {
let _root = $(this);
return new Promise((resolve, reject) => {
//Animation Event Definitions
@bayareawebpro
bayareawebpro / Select2MultiDropDown.js
Last active October 24, 2017 22:36
Select2MultiDropDown
$(document).ready(function() {
$.fn.select2.defaults.set("theme","bootstrap");
function DDsetState($element, $state){
$element.select2('val', null);
if($state === true){
$element.prop("disabled", false);
}else{
$element.prop("disabled", true);
@php
$key = '~/.ssh/host_key';
$host = 'user@host.com';
$connection = '-i '.$key.' '.$host;
$home = '/home/myroot';
$development = $home.'/webapps/dev';
$releases = $home.'/webapps/deployments/releases';
$storage = $home.'/webapps/deployments/storage';
$current = $home.'/webapps/deployments/current';
$release = $releases.'/ver_'.date('YmdHis');
@bayareawebpro
bayareawebpro / CallEnvoyFromRoute.php
Created November 2, 2017 23:07
Call Envoy from Route
<?php
$result = [];
$task = 'deploy';
$live = true;
$process = new \Symfony\Component\Process\Process('/Applications/MAMP/bin/php/php7.1.0/bin/php ~/.composer/vendor/bin/envoy run '. $task);
$process->setTimeout(3600);
$process->setIdleTimeout(300);
$process->setWorkingDirectory(base_path());
$process->run(
<?php
class DataModel{
// Hold an instance of the class
private static $instance;
private $data;
private function __construct() {
$this->data = array();
}
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="none" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="description" content="admin login">
<title>Admin - {{ Voyager::setting("admin.title") }}</title>
<link rel="stylesheet" href="{{ voyager_asset('css/app.css') }}">
public function buildSchema() {
$sanJose = Schema::place()
->name('First Security Services')
->alternateName('Santa Clara County Office')
->additionalType('LocalBusiness')
->sameAs([
'https://plus.google.com/118059828266473072030/',
@bayareawebpro
bayareawebpro / ModelVuePropsExample.php
Last active November 16, 2017 17:29
Model Vue Props Example
<?php
//Your Model
protected $appends = [
'vue_props',
];
//Props Ancestor Attribute
public function getVuePropsAttribute(){
$props = (object) array();
@bayareawebpro
bayareawebpro / RecursiveCollections.php
Last active November 21, 2017 16:29
Convert Nested Arrays into Collections
<?php
use \Illuminate\Support\Collection;
Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value)) {
return collect($value)->recursive();
}
return $value;
});