Skip to content

Instantly share code, notes, and snippets.

View Javlopez's full-sized avatar

Javier Lopez Lopez Javlopez

View GitHub Profile
@Javlopez
Javlopez / users.sql
Created November 10, 2011 02:31
Database - Table users
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`email` varchar(127) NOT NULL,
`username` varchar(32) NOT NULL DEFAULT '',
`password` char(80) NOT NULL,
`token` char(80) NOT NULL DEFAULT '',
`logins` int(10) UNSIGNED NOT NULL DEFAULT '0',
`last_login` int(10) UNSIGNED,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@Javlopez
Javlopez / a1.php
Created November 9, 2011 17:38
A1 hack
<?php
//Added for prevent changes in a1_cores
/**
* User AUTHENTICATION module for Kohana PHP Framework using bcrypt
*
* bcrypt is highly recommended by many to safely store passwords. For more
* information, see http://codahale.com/how-to-safely-store-a-password/
*
* Based on Kohana's AUTH, Fred Wu's AUTHLITE and Woody Gilk's Bonafide
*
@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);
@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 / test.js
Created September 2, 2011 15:16
Json
$.post('/account/updateprofile',$form.serialize(),function(Response){
console.log(Response);
},'json');
@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 / 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 / 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 / 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'];
?>
# 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