Skip to content

Instantly share code, notes, and snippets.

View fhferreira's full-sized avatar
🏠
Home-Office since 2005

Flávio H. Ferreira fhferreira

🏠
Home-Office since 2005
View GitHub Profile
@skadimoolam
skadimoolam / checkbox.blade.php
Last active February 8, 2020 17:03
Customizable form partials for Laravel - https://laravelcollections.com
@php
$d = $d ?? null; // default value
@endphp
<div class="form-group row">
<label for="{{ $n }}" class="col-sm-4 col-form-label text-md-right"><b>{{ $l }}</b></label>
<div class="col-md-8">
<input id="{{ $n }}" type="checkbox" class="form-control" name="{{ $n }}" value="1" @if(old($n, $d) == '1') checked @endif>
@if ($errors->has($n))
<small class="text-danger">{{ $errors->first($n) }}</small>
@PokeGuys
PokeGuys / Dockerfile
Last active August 15, 2019 16:09
LEMP with Swoole
FROM php:7.2.8-fpm
RUN apt-get update && apt-get install -my wget gnupg
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get update && apt-get -y --no-install-recommends install apt-transport-https
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
@JBaczuk
JBaczuk / addrgen
Created December 15, 2018 20:00
addrgen
#!/bin/bash
echo
echo "Welcome to the Bitcoin address generator!"
echo "input private key (32 bytes, hex format)"
read priv
echo ""
echo "#####################################"
# priv=0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D # Testing only
@avosalmon
avosalmon / upload-s3-webpack.mix.js
Last active July 9, 2022 18:24
Upload assets to S3 using Laravel Mix
const mix = require('laravel-mix');
const s3Plugin = require('webpack-s3-plugin');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
@DavidMRGaona
DavidMRGaona / SecureHeaders.php
Created November 21, 2018 15:04
Laravel Middleware to add/remove headers
<?php
namespace App\Http\Middleware;
use Closure;
class SecureHeaders
{
// Enumerate unwanted headers
private $unwantedHeaderList = [
@fhferreira
fhferreira / google direction.js
Created November 15, 2018 21:43
google direction
var maps = require("@google/maps");
var client = maps.createClient({
key: "AIzaSyCSA6hgjkJhkvwO7OP9dG230uEP0ryFXns"
});
function generateDateTime(hour, minutes) {
var d = new Date();
d.setHours(hour,minutes,0,0);
d.setDate(d.getDate() + 1);
@JBaczuk
JBaczuk / how_to_mine_genesis_block_1
Created November 8, 2018 14:22
How to mine genesis block snippet 1
/**
* Build the genesis block. Note that the output of its generation
* transaction cannot be spent since it did not originally exist in the
* database.
*
* CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
* CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
* CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
* vMerkleTree: 4a5e1e
setTimeout(function() {
function getAllModules() {
return new Promise((resolve) => {
const id = _.uniqueId("fakeModule_");
window["webpackJsonp"](
[],
{
[id]: function(module, exports, __webpack_require__) {
resolve(__webpack_require__.c);
}
@martinsoender
martinsoender / responsive-image.liquid
Last active April 14, 2021 20:22
Responsive image snippet
{% comment %} Default images {% endcomment %}
{% assign PHONE_IMAGE = image %}
{% assign TABLET_IMAGE = image %}
{% assign DESKTOP_IMAGE = image %}
{% comment %} Default widths {% endcomment %}
{% assign PHONE_IMAGE_WIDTH = '640x' %}
{% assign TABLET_IMAGE_WIDTH = '768x' %}
{% assign DESKTOP_IMAGE_WIDTH = '1440x' %}
@mhhansen
mhhansen / pwa-studio-setup-magento-230-alpha.txt
Last active October 19, 2019 08:10
Magento PWA Studio setup with 2.3.0-alpha
################################################################
# NODE: 8.11.2
# NPM: 5.6.0 (I prob should upgrade this one)
# MySQL: 5.7
# PHP: 7.1
################################################################
################################################################
################################
### DOWNLOAD AND PREPARE MAGENTO TO INSTALL
# assuming you are in /<YOUR_PROJECT_FOLDER>/