Skip to content

Instantly share code, notes, and snippets.

View jechav's full-sized avatar
🏠
Working from home

Jose Echavez M jechav

🏠
Working from home
View GitHub Profile
@jechav
jechav / slug.php
Created August 26, 2015 13:45
Laravel Slug function
public static function getEventSlug($title) {
$slug = Str::slug($title);
$slugCount = count( Service::whereRaw("slug REGEXP '^{$slug}(-[0-9]*)?$'")->get() );
return ($slugCount > 0) ? "{$slug}-{$slugCount}" : $slug;
}
@jechav
jechav / controller.js
Last active August 29, 2015 14:26
ngCordova, facebook y twitter
//Facebook login
$scope.fbLogin = function() {
$cordovaOauth.facebook("1495786770635908", ["email"]).then(function(result) {
//alert(result.access_token);
$token = result.access_token;
$ionicLoading.show();
$http.get('https://graph.facebook.com?access_token='+$token+'&ids=me').success(function(data){
sendData = {
id: data.me.id,
username: data.me.first_name,
//Modal
.modal.fade .modal-dialog {
-webkit-transform: scale(0.1);
-moz-transform: scale(0.1);
-ms-transform: scale(0.1);
transform: scale(0.1);
top: 300px;
opacity: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@jechav
jechav / app.php
Last active August 29, 2015 14:27
Laravel public_path() setup images upload
# bootstrap/app.php
//if production .env set APP_PUBLIC=../hogarExperto/ for example
if(env('APP_PUBLIC') != NULL){
$app->bind('path.public', function() {
return base_path().env('APP_PUBLIC');
});
}
@jechav
jechav / setup_howto.txt
Created October 5, 2015 00:14 — forked from kosiara/setup_howto.txt
Setup Facebook React-native sample (empty) project on Ubuntu
# author:
# @Bartosz Kosarzycki
#
sudo apt-get install npm
sudo npm install -g react-native-cli
sudo ln -s /usr/bin/nodejs /usr/bin/node
cd /home/user/your/project/path
react-native init AwesomeProject
cd AwesomeProject
@jechav
jechav / angular-directives.js
Last active February 7, 2016 01:38
angular general directives
//********* load image if src dont found **********//
myApp.directive('onErrorSrc', function() {
return {
link: function(scope, element, attrs) {
if(!attrs.src){
attrs.$set('src', attrs.onErrorSrc);
return;
}
@jechav
jechav / install-composer.sh
Last active April 26, 2016 23:07 — forked from matthewpizza/install-composer.sh
Install Composer on Webfaction
cd $HOME
ln -s `which php56` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php56
echo -e "\n# Composer\nalias composer=\"php56 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@jechav
jechav / gulpfile.js
Last active February 6, 2017 22:04
check files in vendor.js exits
var fs = require('fs');
function checkFiles(list){
list.forEach((path) => {
if (!fs.existsSync(path)) {
console.log('-- Not found '+path)
}
})
}
var fr = new FileReader(), buf, file = element.files[0];
var etags = [];
var partSize = 6 * 1024 * 1024; // constant
var totalSize = file.size;
var numParts = Math.ceil(totalSize / partSize);
var key = null;
var uplaodId = null;
// 1. Init Upload
coverService.initUpload({fileName: file.name, fileType: 'video'}, function(res){