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 / facebookToken.md
Last active April 25, 2016 17:28
AccessToken Facebook connect with javascript and php 5

#Facebook Access Token

Aquí en este ejemplo veremos como obtener la información del usuario del lado backend enviando el accesstoken desde el cliente mediante javascript.

fbAsyncInit.js

 window.fbAsyncInit = function() {
  FB.init({
    appId      : '{{APPID}}',
    xfbml      : true,
@juanpablocs
juanpablocs / create_files_recursive.php
Last active May 2, 2016 23:09
create files and folder recursive
<?php
$folder = "./myfolder";
$bucket = $folder."/bucket";
$max_folders = 11;
$max_files = 5;
$name_file = "file".rand(9999,999999).".txt";
$url_file = "./file.txt";
$number = function($n){ return ($n<10) ? "0{$n}" : $n; };
for ($i=0; $i < $max_folders; $i++) {
@juanpablocs
juanpablocs / php_mongo.md
Last active July 8, 2016 03:58
mongo relational join php

##Mongo relation## test php mongo relational songs and users

init variables

<?php
$connect  = new \MongoClient($this->settings['mongo_connection']);
$database = $connect->mydb;
$col_mp3  = $database->mp3;
$col_user = $database-&gt;user;
@juanpablocs
juanpablocs / soundcloud.go
Created August 28, 2016 22:02
demo request and process json soundcloud with golang
package main
import (
"fmt"
"log"
"net/http"
"encoding/json"
"io/ioutil"
)
const API_KEY = "38682c40bf52f8885ae2ba6dc6ffae81"
@juanpablocs
juanpablocs / vmuzice.go
Created August 28, 2016 22:54
demo scraping vmuzice with golang
package main
import (
"fmt"
"log"
"net/http"
"io/ioutil"
"regexp"
)
const URL = "http://vmuzice.com/mp3/salsa"
@juanpablocs
juanpablocs / reactes6.md
Last active August 29, 2016 19:44
Ejemplo de react + es6 + webpack + flux

#React es6

Trabajando con flux y react 2016

create folder

mkdir demo-flux && cd demo-flux

initialize npm

@juanpablocs
juanpablocs / golang.md
Last active September 1, 2016 19:03
primeros pasos con golang

#Primeros pasos en GO

tipos

// tipo integer
var num int = 1
//tipo string
var str string = "hello"
//aqui no es necesario declarar var
//al colocar : go detecta el tipo a esto se le llama autotipado
@juanpablocs
juanpablocs / README.md
Last active September 16, 2016 14:19
Npm run script only browserify + es6 + sass

#Es6 + sass

package.json work babelify and browserify

{
  "name": "es6_sass",
  "version": "1.0.0",
 "description": "",
@juanpablocs
juanpablocs / post-receive
Last active February 15, 2017 23:15
Git hook post-receive, compile js files gulp or webpack etc and valid other files
#!/bin/bash
PROJECT="/home/nginx/domains/mywebiste/public"
PROJECT_STAGING="/home/nginx/domains/pre.mywebiste/public"
while read oldrev newrev ref
do
# guarda archivos modificados en variable
output_files="$(git diff-tree -r --name-only --no-commit-id $oldrev..$newrev)"
#comprueba la salida de los archivos modificados, si coincide con el primer param ejecuta el segundo param
check_run() {
@juanpablocs
juanpablocs / command
Last active February 16, 2017 01:10
replace static file and add timestamp for cached in layout html
sed -ri \"s/myjs\.js([^\"]+|)\"/min.js?$(date +%s)\"/g" ./mylayout.twig
#replace this
<script src="/myjs.js"></script>
or
<script src="/myjs.js?1487206735"></script>
with this
<script src="/myjs.js?2348392493284932"></script>