Skip to content

Instantly share code, notes, and snippets.

View JoseCage's full-sized avatar
:octocat:
Opensourcing

José Cage JoseCage

:octocat:
Opensourcing
View GitHub Profile
function createStore({ state, mutations }) {
return {
state: Vue.observable(state),
commit(key, ...args) {
mutations[key](state, ...args)
}
}
}
const store = createStore({
state: { count: 0 },
public function index(Request $request)
{
$sortBy = 'id';
$orderBy = 'desc';
$perPage = 20;
$q = null;
if ($request->has('orderBy')) $orderBy = $request->query('orderBy');
if ($request->has('sortBy')) $sortBy = $request->query('sortBy');
if ($request->has('perPage')) $perPage = $request->query('perPage');
@freekmurze
freekmurze / bookmarklet
Last active February 22, 2019 10:13
Oh Dear! Reachable bookmarklet
javascript:{window.location='https://ohdear.app/tools/reachable?prefill='+encodeURIComponent(window.location.href)}
@calebporzio
calebporzio / chain_helper.php
Last active July 23, 2023 04:27
Handy "chain()" helper method for making non-fluent classes/objects fluent.
<?php
function chain($object)
{
return new class ($object) {
protected $lastReturn = null;
public function __construct($object)
{
$this->wrapped = $object;
@sindresorhus
sindresorhus / issuehunt-bounties.md
Last active July 5, 2019 08:51
IssueHunt bounties
@ssisaias
ssisaias / WSO2-Axiom-RemoveTagFromPayload.java
Last active April 18, 2019 16:57
Remove tag from payload using WSO2 axiom engine and custom mediators
public boolean mediate(MessageContext context) {
try {
String test = context.getProperty("mock_property").toString();
OMElement xmlPayload = AXIOMUtil.stringToOM(test);
//log.info(xmlPayload);
OMElement envelope = context.getEnvelope().getBody().getFirstElement();
//log.info(envelope);
OMElement body = envelope.getFirstElement();
//log.info(body);
OMElement items = body.getFirstElement();
@mirkorap
mirkorap / symfony4-fos-oauth-server-bundle.md
Last active February 22, 2024 14:51
Basic examples how to implement a REST API with Symfony 4 + FOSRestBundle + FOSUserBundle + FOSOauthServerBundle with all oauth2 code flow
@freekmurze
freekmurze / DiscordChannel.php
Last active July 21, 2022 14:12
How to use Discord webhooks
<?php
namespace App\Services\NotificationChannels\Discord;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use Illuminate\Notifications\Notification;
class DiscordChannel
{
@lorisleiva
lorisleiva / GoogleApiAccess.md
Last active May 13, 2024 14:20
This gist describes two processes allowing us to access the Google API and to register some webhooks

Access Google API credentials and domain verification

This gist describes two processes allowing us to access the Google API and to register some webhooks. At the end of both processes we will obtain all variable needed to start using their API and we will have whitelisted all necessary URL to get started. We will be using the Google Calendar API and the Google Plus API to access the email address of the user.

This gist has been created as an Appendix to this article (part 1) and this article (part 3).

Note that, I will be using a randomly generated ngrok domain during this presentation. Simply replace b3093b51.ngrok.io with your domain name


@whoisryosuke
whoisryosuke / AttachJwtToken.php
Created July 27, 2018 08:42
Laravel - Testing - Base class to extend basic API tests
<?php
namespace Tests\Traits;
use KushyApi\User;
trait AttachJwtToken
{
/**
* @var User