Skip to content

Instantly share code, notes, and snippets.

//get time
date
//sincronizar con reloj nasa
sudo ntpdate -u ntp.nasa.gov time-b.nist.gov
@sangar82
sangar82 / gist:c514db0c34980602d7e0
Last active August 29, 2015 14:06
new UploadedFile
public function testStorePhoto_Ok () {
$path = /* path/to/your/file */;
$filename = /* your/file/name */;
$mimeType = /* your/file/mime/type es: 'image/jpeg' */
$file = new Symfony\Component\HttpFoundation\File\UploadedFile (
$path . $filename,
$filename,
$mimeType
);
@sangar82
sangar82 / gist:2eb42e67ddc0be45d727
Created July 31, 2014 14:47
laravel/vendor/league/fractal/src/Pagination\IlluminatePaginatorAdapter.php
/**
* Override method so includes work with pagination
* @param Int $page
* @return String
*/
public function getUrl($page)
{
$parameters = array(
$this->factory->getPageName() => $page,
);
$ curl -sS https://getcomposer.org/installer | php
$ (sudo) mv composer.phar /usr/local/bin/composer
Manual Method
I found an easier way to globally install composer than the manual proscribed in the github readme.md. It's actually on the getcomposer.org website:
$ curl -s http://getcomposer.org/installer | php
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
For the scenario, imagine posts has a foreign key user_id referencing users.id
```php
public function up()
{
Schema::create('posts', function(Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('body');

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');
@sangar82
sangar82 / gist:53f5a0485bfd2041f4c4
Created May 27, 2014 13:01
use PHP version of mamp
alias phpmamp='/Applications/MAMP/bin/php5.3/bin/php'
or
I have created a symlink at the original php location.
1. Locate your osx php version with:
which php
The result should be:
@sangar82
sangar82 / gist:9598502
Last active August 29, 2015 13:57
Create sequence postgresql
DROP SEQUENCE chat_id_seq
CREATE SEQUENCE chat_id_seq;
DROP TABLE "chat";
CREATE TABLE "chat" (
"id" int4 NOT NULL DEFAULT nextval('chat_id_seq'),
"text" text,
"installation_object_id" varchar(256),
"created_at" date,
"updated_at" date,
"account_name" text,
@sangar82
sangar82 / gist:9597499
Created March 17, 2014 11:10
Flush DNS OSX Mavericks
dscacheutil -flushcache
sudo killall -HUP mDNSResponder