Skip to content

Instantly share code, notes, and snippets.

View Javlopez's full-sized avatar

Javier Lopez Lopez Javlopez

View GitHub Profile
@Javlopez
Javlopez / test.php
Created June 29, 2011 19:08
Implementation of A2
<?php defined('SYSPATH') or die('No direct script access.');
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Test
*
* @author Javier Lopez Lopez
<?php
//..
//.........
$userid = 1; //Obtenemos el id del susuario que lo posteo
if(A2::instance()->allowed('discussion','edit') AND $userid == A2::instance()->get_user()->id)
{
echo "si puedes modificar esto";
}
?>
# ifup wlan0
Internet Systems Consortium DHCP Client xxxx
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/xx:xx:xx:xx:xx:xx
Sending on LPF/wlan0/xx:xx:xx:xx:xx:xx
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
@Javlopez
Javlopez / php5_4.php
Created July 23, 2011 22:25
PHP5.4 Short syntax for arrays
<?php
// Square bracket array shortcut - keys and values are separated by colons:
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
//Square bracket array shortcut - keys and values are separated by double arrows:
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
?>
@Javlopez
Javlopez / get_array_categorys.php
Created July 29, 2011 04:08
Sencillo script que permite extraer categorias y subcategorias de wordpress a un array
<?php
/**
*@example $array_categorys = get_array_categorys();
*/
function get_array_categorys()
{
$categories = get_categories(array('type' => 'post','orderby' => 'name','order' => 'ASC','hide_empty' => false));
$wp_cat = array();
//Get categorys parents
@Javlopez
Javlopez / index.php
Created August 22, 2011 21:31
Rest implementation
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
/*
*
* ASI DEBE de SALIR
/users/
/users/add
/users/javier/delete
@Javlopez
Javlopez / login.php
Created August 30, 2011 14:23
Example login php
<?php
if( ! $this->a1->login(Arr::get($post,'username',""),Arr::get($post,'password',""),Arr::get($post, 'remember', FALSE)))
{
if(Model_Users::unique_username($post['username']))
{
throw new Kohana_Exception('Inexisting email');
}
throw new Kohana_Exception('Wrong password');
}
@Javlopez
Javlopez / test.js
Created September 2, 2011 15:16
Json
$.post('/account/updateprofile',$form.serialize(),function(Response){
console.log(Response);
},'json');
@Javlopez
Javlopez / .gitignore
Created September 5, 2011 16:33
Git Ignored files to kohana Framework 3.2
/.git
/.settings
/.buildpath
/example.htaccess
/temp
/queue
.DS_Store
.project
.buildpath
.settings
@Javlopez
Javlopez / json.php
Created September 29, 2011 20:05
Ejemplo de json en PHP
<?php
$array = array(
array(1,25),
array(2,50),
array(3,30),
);
$edades = json_encode($array);