Skip to content

Instantly share code, notes, and snippets.

View nunomaduro's full-sized avatar

Nuno Maduro nunomaduro

View GitHub Profile
@nunomaduro
nunomaduro / rector.yaml
Created March 19, 2020 11:47
rector.yaml
# rector.yaml
parameters:
sets:
- 'action-injection-to-constructor-injection'
- 'array-str-functions-to-static-call'
- 'celebrity'
- 'doctrine'
- 'phpstan'
- 'phpunit-code-quality'
- 'solid'
type ConstructorOf<TObject> = new (...input: any[]) => TObject;
class User { readonly name: string = 'Foo'; }
type HasGetName = { readonly getName: () => string; };
const getName = <TUser extends ConstructorOf<User>>(Base: TUser) => {
return class extends Base implements HasGetName {
public getName() { return this.name; }
};
Vue warn]: Property or method "searchClient" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
(found in <Root>)
warn @ app.js:68765
warnNonPresent @ app.js:70178
has @ app.js:70223
(anonymous) @ VM153:3
Vue._render @ app.js:71676
updateComponent @ app.js:72192
get @ app.js:72603
<body>
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div id="app"><div class="ais-InstantSearch"></div></div>
<script src="/js/app.js"></script>
<script>
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div id="app">
<!-- In a default Laravel app, Vue will render inside an #app div -->
<ais-instant-search
:search-client="searchClient"
index-name="{{ (new App\User)->searchableAs() }}"
@nunomaduro
nunomaduro / upgrade-guide.md
Last active March 27, 2019 12:34
Python 2.0's upgrade-guide

Upgrading To 2.0.0 From 1.20.0

We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the API Client only a portion of these changes may actually affect your application.

Upgrade your algoliasearch dependency to >=2.0,<3.0 using pip:

pip install --pre algoliasearch 

This Pull Request introduces the upcoming Algolia API Client Python v2.

Preface

  • Follows 100% of the API Client v2 specs, just like PHP v2, c# v2: contains waitable response objects, up-to-date retry strategy, replace_all_objects,clear_objects, and more!

  • Supports Python: 2.7 🥳, 3.4, 3.5, 3.6, and 3.7.

  • Strong test suite, 100% test coverage on unittest (tests === 30secs locally! 🏎), flake8 (linter), and mypy (static-analysis) to ensure the quality of the code.

@nunomaduro
nunomaduro / scout_extended_facades_client.php
Created December 20, 2018 14:26
Scout Extended Facades Client
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$client = Algolia::client();
$apiKeys = $client->listApiKeys();
$indices = $client->listIndices();
$client->copyIndex('indexNameSrc', 'indexNameDest');
$client->moveIndex('indexNameSrc', 'indexNameDest');
@nunomaduro
nunomaduro / scout_extended_facades_analytics.php
Created December 19, 2018 13:50
Scout Extended Facades Analytics
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$analytics = Algolia::analytics();
$test = $analytics->getABTest('a-unique-identifier');
// ...