Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
👨‍💻 Coding..

Juan pablo juanpablocs

💭
👨‍💻 Coding..
View GitHub Profile
@juanpablocs
juanpablocs / github_get_repo.js
Last active August 29, 2015 14:25
get name repository from url github
View github_get_repo.js
//get name github url from javascript
var repo_url = "http://github.com/frontend-labs/flux"; //obtain => flux
var name = repo_url.replace(/http(?:s|)\:\/\/(?:www\.|)github\.com\/(?:.*?)\/(.*?)/, "$1")
console.log(name); // flux
@juanpablocs
juanpablocs / count.js
Last active October 22, 2015 17:50
Count number by coincidences into an array (Javascript)
View count.js
/*
@author: juanpablocs21@gmail.com
@param: array (evaluate)
@return: array
*/
function count_numbers(arr){
var c = {};
var result = [];
for(e in arr){
n = arr[e]
View test_readfile_vs_file..
```
<?php
$file = "audio.mp3";
ob_start();
$start = microtime(true);
echo file_get_contents($file);
$end = microtime(true) - $start;
ob_end_clean();
echo 'file_get_contents: '.$end;
@juanpablocs
juanpablocs / youtube_mp3.php
Last active November 21, 2015 00:57
script que descarga videos de youtube en formato mp3 sin necesidad de FFMPEG
View youtube_mp3.php
<?php
// instalar youtube-dl en el sistema (linux)
// > sudo curl https://yt-dl.org/downloads/2015.11.19/youtube-dl -o /usr/local/bin/youtube-dl
// > sudo chmod a+rx /usr/local/bin/youtube-dl
// dar permiso 777 a la carpeta destino
// chmod 777 -R tufolder
// eso es todo :)
@juanpablocs
juanpablocs / HackAdsense.js
Created December 6, 2015 21:20
in progress
View HackAdsense.js
function HackAdsense(option)
{
this.interval = 0;
this.bodyClicked = false;
this.iframeWrapper = null;
this.iframeId = 'frm' + Math.round(Math.random()*999999999);
this.option = option;
this.run = function(){
var self = this;
@juanpablocs
juanpablocs / gulp dist
Last active December 10, 2015 21:36
tarea para concatenar todos los archivos css por modulo
View gulp dist
```javascript
/*!!
* @author: Juan Pablo
* Tarea para comprimir y combinar todos los archivos compilados
* a un archivo final
* http://stackoverflow.com/a/23731040
*
* tarea : gulp build
* instalar : npm install event-stream --save-dev
*/
@juanpablocs
juanpablocs / nginx slim framework
Created December 17, 2015 23:04
mi configuración para trackear urls distintas a /
View nginx slim framework
```
server {
server_name www.mysite.com;
return 301 $scheme://mysite.com$request_uri;
}
server {
server_name mysite.com;
root /home/nginx/domains/mysite.com;
@juanpablocs
juanpablocs / nginx slim framework
Last active December 17, 2015 23:40
mi configuración para trackear urls distintas a /... si no se coloca $query_string nginx da error cuando colocas por ejemplo /?hola=1
View nginx slim framework
```
server {
server_name www.mysite.com;
return 301 $scheme://mysite.com$request_uri;
}
server {
server_name mysite.com;
root /home/nginx/domains/mysite.com;
@juanpablocs
juanpablocs / directv.php
Last active January 25, 2016 19:41
scraping for program guide. get info in json and save result data to xml
View directv.php
<?php
// programador: juanpablocs21@gmail.com
//
class directv
{
var $url = "http://www.directv.com.ve/movil/ProgramGuide/ProgramGuide";
public function getProgramation($ids)
{
$html = $this->html($this->url);
@juanpablocs
juanpablocs / angular.es6.md
Last active April 14, 2016 18:49
angular with ecmac script 6
View angular.es6.md

usar alguna herramienta para tratar modulos ejemplo : (webpack, browserify)

ejemplo básico

js:

// import angular
import angular from 'angular';
// init angular