Skip to content

Instantly share code, notes, and snippets.

@galiazzi
galiazzi / apollo.js
Last active August 29, 2019 02:31
Vue apollo
import Vue from "vue";
import VueApollo from "vue-apollo";
import ApolloClient from "apollo-boost";
Vue.use(VueApollo);
const token = "";
const apolloClient = new ApolloClient({
uri: "http://localhost:8000/graphql",
<?php
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
<?php
function isSequencialArray($arr)
{
return is_array($arr) && array_keys($arr) === range(0, count($arr) - 1);
}
module.exports = {
extends: ['@commitlint/config-conventional']
}
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const isProduction = (process.env.NODE_ENV === 'production');
module.exports = {
#!/bin/bash
WEBDIR=/home/web/public/
RANDOM_NAME=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
echo "<?php opcache_reset(); ?>" > ${WEBDIR}${RANDOM_NAME}.php
curl http://localhost/${RANDOM_NAME}.php
rm ${WEBDIR}${RANDOM_NAME}.php
echo "Opcache reseted"
@galiazzi
galiazzi / Cast.php
Last active May 7, 2024 12:04
Doctrine DQL cast function
<?php
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
class Cast extends FunctionNode
{
private $expr1;
@galiazzi
galiazzi / service-forever.bsh
Last active May 7, 2018 12:31
Configuração de um serviço no linux utilizando forever
#!/bin/bash
#
# description: DevShelf service
# processname: node
# pidfile: /var/run/devshelf.pid
# logfile: /var/log/devshelf.log
#
# Based on https://gist.github.com/jinze/3748766
#
# To use it as service on Ubuntu: