Skip to content

Instantly share code, notes, and snippets.

View lucascardial's full-sized avatar
:shipit:
Full Stack

Lucas Cardial lucascardial

:shipit:
Full Stack
View GitHub Profile
@lucascardial
lucascardial / install-php-amqp.sh
Created September 18, 2020 18:29 — forked from wcomnisky/install-php-amqp.sh
Install PHP AMQp on MacOS
#!/bin/bash
brew search librabbitmq
brew install rabbitmq-c
pecl install amqp
# set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.10.0
# if it fails follow the following (reference: https://github.com/pdezwart/php-amqp/issues/355#issuecomment-563203121):
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
import React, { useCallback, useRef, useEffect } from 'react';
import {
Image,
View,
ScrollView,
KeyboardAvoidingView,
Platform,
TextInput,
Alert,
Linking,
import React, { useCallback, useRef, useEffect } from 'react';
import {
Image,
View,
ScrollView,
KeyboardAvoidingView,
Platform,
TextInput,
Alert,
Text,
@lucascardial
lucascardial / redux-saga-typeguard.ts
Created June 29, 2020 17:44 — forked from NoriSte/redux-saga-typeguard.ts
Redux-saga + Typescript: implementing typeguard for Axios AJAX requests
import { AxiosResponse } from "axios";
// the kind of data I expect from the AJAX request...
interface AuthData {
access_token?: string;
refresh_token?: string;
}
// ... a type dedicated to the Axios response...
type AuthResponse = AxiosResponse<AuthData>;
#!/bin/bash
hda-verb 0x19 SET_PIN_WIDGET_CONTROL 0x25
hda-verb 0x21 SET_UNSOLICITED_ENABLE 0x83
echo -e "Done"
import {NavigationActions} from 'react-navigation';
let nav;
function setTopLevelNavigator(navigatorRef) {
nav = navigatorRef;
}
function navigate(routeName, params) {
nav.dispatch(NavigationActions.navigate({routeName, params}));
version: "3"
services:
mysql:
container_name: mysql
image: mysql:5.7
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: <!!sua-senha!!>
volumes:
{
sensor string,
on_value number,
on_condition string enum(">=", "<=")
off_value number,
off_condition string enum(">=", "<=")
}
@lucascardial
lucascardial / metro.config.js
Created January 27, 2020 18:50
react-native-svg
const {getDefaultConfig} = require('metro-config');
module.exports = (async () => {
const {
resolver: {sourceExts, assetExts},
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},