Skip to content

Instantly share code, notes, and snippets.

View juanpablocs's full-sized 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
//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)
/*
@author: juanpablocs21@gmail.com
@param: array (evaluate)
@return: array
*/
function count_numbers(arr){
var c = {};
var result = [];
for(e in arr){
n = arr[e]
```
<?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
<?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
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
```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 /
```
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
```
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
<?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

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

ejemplo básico

js:

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