Skip to content

Instantly share code, notes, and snippets.

View alysdal's full-sized avatar

Andreas Lysdal Andersen alysdal

View GitHub Profile
@alysdal
alysdal / pt.fish
Created September 10, 2017 13:03
File location: ~/.config/fish/functions/pt.fish
function pt
gittower $argv
open -a PhpStorm $argv
end
$groups = Groups::all();
$arr = [];
foreach ($groups as $group) {
$item = $group->toArray();
$item['active_bets'] = $group->bets()->active()->count(); // går ud fra du har lavet et eloquent scope der hedder active
$arr[] = $item;
}
return response()->json($arr);
@alysdal
alysdal / pullhook.php
Created November 10, 2016 11:31
A pullhook script for laravel installations
<pre>
<?php
// remember to rename the file to a random string to prevent abuse
system('cd .. && git pull && composer install && php artisan migrate --force');
### Keybase proof
I hereby claim:
* I am alysdal on github.
* I am andreaslysdal (https://keybase.io/andreaslysdal) on keybase.
* I have a public key whose fingerprint is 13FB 64FD F4E1 9148 3BB2 9CDC 9C13 D3A2 56E8 E21E
To claim this, I am signing this object:
<?php
// device info
$deviceID = "390024001347343338333633";
$accessToken = "fa2405080d01b918e0574a0f23a0b06c64332305";
$command = "setcolor";
// api url
$url = "https://api.particle.io/v1/devices/".$deviceID."/".$command."?access_token=".$accessToken;
@alysdal
alysdal / dbconnection.php
Last active April 24, 2016 18:33
Filer til web workshop 2016
<?php
// database credentials
$dbHost = 'localhost';
$dbName = 'webworkshop';
$dbUser = 'root';
$dbPass = 'root';
try {
// attempt to connect to the database
$db = new PDO('mysql:host=' . $dbHost . ';dbname=' . $dbName . ';charset=UTF8', $dbUser, $dbPass);
@alysdal
alysdal / dbconnection.php
Last active April 25, 2016 04:26
PHP eksempler fra en workshop
<?php
// database credentials
$dbHost = 'localhost';
$dbName = 'webworkshop';
$dbUser = 'root';
$dbPass = '';
try {
// attempt to connect to the database
$db = new PDO('mysql:host=' . $dbHost . ';dbname=' . $dbName . ';charset=UTF8', $dbUser, $dbPass);