Skip to content

Instantly share code, notes, and snippets.

View sonOfRa's full-sized avatar

Simon Levermann sonOfRa

View GitHub Profile
>>> Carbon\Carbon::parse('2015-01-01')
=> Carbon\Carbon {#864
+"date": "2015-01-01 00:00:00.000000",
+"timezone_type": 3,
+"timezone": "UTC",
}
>>> Carbon\Carbon::parse('2015-01-01')->timezone('Europe/Madrid')
=> Carbon\Carbon {#861
+"date": "2015-01-01 01:00:00.000000",
+"timezone_type": 3,
@sonOfRa
sonOfRa / raw.sql
Last active October 4, 2017 09:36
SELECT *
FROM entries
WHERE (entries.category_id, entries.in_category_id, COALESCE(entries.in_category_sub_id, 'UNIQUE SENTINEL')) IN (
SELECT
entries.category_id,
entries.in_category_id,
COALESCE(entries.in_category_sub_id, 'UNIQUE SENTINEL')
FROM entries
GROUP BY entries.category_id, entries.in_category_id, COALESCE(entries.in_category_sub_id, 'UNIQUE SENTINEL')
HAVING COUNT(*) > 1
<?php
namespace App\Rules;
use App\Entry;
use Illuminate\Contracts\Validation\Rule;
/**
* Class UniqueCategoryId
*
do {
$input = readline("Detected non-human name '$name'. How many names is this?: ");
} while(!(is_numeric($input) && preg_match('/\d+/', $input)));
SELECT `resourceId`, `resourceType`, `resourceTitle`, `resourceSubtitle`, `resourceShortTitle`, `resourceTitleSort`, `resourceTransTitle`, `resourceTransSubtitle`, `resourceTransShortTitle`, `resourceField1`, `resourceField2`, `resourceField3`, `resourceField4`, `resourceField5`, `resourceField6`, `resourceField7`, `resourceField8`, `resourceField9`, `resourceNoSort`, `resourceTransNoSort`, `resourceIsbn`, `resourceBibtexKey`, `resourceDoi`, `resourcepageId`, `resourcepagePageStart`, `resourcepagePageEnd`, `resourceyearId`, `resourceyearYear1`, `resourceyearYear2`, `resourceyearYear3`, `resourceyearYear4`, `resourcemiscId`, `resourcemiscCollection`, `resourcemiscPublisher`, `resourcemiscField1`, `resourcemiscField2`, `resourcemiscField3`, `resourcemiscField4`, `resourcemiscField5`, `resourcemiscField6`, `resourcemiscTag`, `resourcemiscAddUserIdResource`, `resourcemiscEditUserIdResource`, `resourcemiscAccesses`, `resourcemiscMaturityIndex`, `resourcemiscPeerReviewed`, `resourcemiscQuarantine`, `resourcemiscAcc
<?php
namespace App\Http\Controllers;
use App\Category;
use App\Collection;
use App\Creator;
use App\Entry;
use App\EntryType;
use App\Keyword;
@if($entry->publisher)
{{ $entry->publisher->name }}
@endif
<?php
/**
* Display the specified resource.
*
* @param \App\Category $category
* @return \Illuminate\Http\Response
*/
public function show(Category $category)
{
return view('categories.show', ['category' => $category]);
<!DOCTYPE html>
<html>
<head>
<title>App - @yield('title')</title>
<link href="{{ mix('/css/app.css') }}" rel="stylesheet">
<script src="{{ mix('/js/app.js') }}"></script>
</head>
<body>
@include('layouts.header')
<div class="container">
@sonOfRa
sonOfRa / LICENSE
Last active August 16, 2017 10:41
NOT SAFE FOR USE IN CRYPTOGRAPHIC LIBRARIES Elliptic curve framework for experimenting NOT SAFE FOR USE IN CRYPTOGRAPHIC LIBRARIES
Licensed under CC0 1.0 Universal. This work is in the Public Domain.
Full license text here: https://creativecommons.org/publicdomain/zero/1.0/legalcode