Skip to content

Instantly share code, notes, and snippets.

View acacha's full-sized avatar

Sergi Tur Badenas acacha

View GitHub Profile
@acacha
acacha / gist:432921448a745d531188
Created December 31, 2015 11:59
Intelligent Lamp with makeblock inventor electronic kit. 2 versions uncommenting some lines
/************************************************************************
* File Name : Smart_table_lamp.ino
* Author : crazyfeng
* Version : V1.0
* Date : 18/07/2014
*Parts required : Smart_table_lamp
* Description :The lamp can light up when someone make sound or go through.
* The Brightness of the lamp is adjustable.
* License : CC-BY-SA 3.0
* Copyright (C) 2013 Maker Works Technology Co., Ltd. All right reserved.
USER=acacha;PAGE=1; curl "https://api.github.com/users/$USER/repos?page=$PAGE&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
/**
* Insert arbitrary text into any place inside a text file
*
* @param string $file_path - absolute path to the file
* @param string $insert_marker - a marker inside the file to
* look for as a pattern match
* @param string $text - text to be inserted
* @param boolean $after - whether to insert text after (true)
* or before (false) the marker. By default, the text is
* inserted after the marker.
@acacha
acacha / gist:82c2265635a207bea544
Created February 17, 2016 17:19
StandardFirmata
/*
Firmata is a generic protocol for communicating with microcontrollers
from software on a host computer. It is intended to work with
any host computer software package.
To download a host software package, please clink on the following link
to open the list of Firmata client libraries your default browser.
https://github.com/firmata/arduino#firmata-client-libraries
@acacha
acacha / platform_game.js
Last active April 1, 2016 14:24
Phaser platform game basic with audio from http://www.lessmilk.com/game/platformer/
var playState = {
preload: function() {
game.stage.backgroundColor = '#3498db';
game.load.spritesheet('player', 'assets/player.png', 28, 22);
game.load.image('wall', 'assets/wall.png');
game.load.image('ground', 'assets/ground.png');
game.load.image('dust', 'assets/dust.png');
<?php namespace PrivacyDriver\Providers;
use Cache;
use Config;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Collection;
use Artisan;
use Gate;
use PrivacyDriver\Cache\PDRedisStore;
<div id="app">
<div v-if="userId">
<p>You are logged in! Your user ID is: {{userId}}</p>
<p>Click <a @click="logout">here</a> to logout</p>
</div>
<div v-if="!userId">
<p>I don't know you. You should <a @click="login">login</a>.</p>
</div>
</div>
@acacha
acacha / hello.js
Last active October 18, 2016 13:52
hello world
function hello($name,$sn1){
echo "Hola " . $name . " " . $sn1 . "!";
}
@acacha
acacha / basicauth.php
Last active November 17, 2016 17:59
PHP HTTP Basic Authentication
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
<?php
use Illuminate\Database\Seeder;
/**
* Class AdminUsersSeeder
*/
class AdminUsersSeeder extends Seeder
{
/**