Skip to content

Instantly share code, notes, and snippets.

View roberto-butti's full-sized avatar
🚀

Roberto Butti roberto-butti

🚀
View GitHub Profile
@roberto-butti
roberto-butti / realtime-component.blade.php
Created March 20, 2021 11:12
Websocket with livewire
<div wire:onmessage="msg_type_1">
Current time: {{ now() }}
</div>
@roberto-butti
roberto-butti / nginx_virtualdomain.conf
Created February 14, 2021 20:12
Virtual Domain configuration in /etc/nginx/sites-available/
server {
listen 80;
listen [::]:80;
# SSL configuration
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
# Set root directive with your /public Laravel directory
root /var/www/ghygen.hi-folks.dev/htdocs/public;
# Set index directive with index.php
index index.php;
@roberto-butti
roberto-butti / RollTheDice.jsx
Last active January 27, 2021 13:20
RollTheDice component
import React, { useState, useEffect } from 'react';
function RollTheDice() {
// 001 : declare a new state variable, "dice" to track the current roll.
const [dice, setNumber] = useState(0);
// 002 : declare a new state variable, "rolls" to track all rolls.
const [rolls, setRolls] = useState([]);
// 003 : implementing useEffect hook in order to change the title of the page on every changes of value of dice.
@roberto-butti
roberto-butti / here_account_oauth1.php
Last active January 11, 2021 12:55
Testing Oauth1 call
<?php
require __DIR__ . "/../vendor/autoload.php";
/**
* Thanks to clear documentation:
* https://developer.twitter.com/en/docs/basics/authentication/oauth-1-0a/creating-a-signature
*
*/
@roberto-butti
roberto-butti / git_command.sh
Created March 30, 2020 06:51
Some git command
# short git log: Comment, Date, Author
git log --pretty=format:'%s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@roberto-butti
roberto-butti / jsconfig.json
Created January 20, 2020 11:07
jsconfig.json
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
@roberto-butti
roberto-butti / APPROVE TIMESHEET
Last active December 20, 2019 14:24
Click all images in the web page, with the id that begins with "approve_img_"
[].forEach.call(
document.querySelectorAll('img[id^="approve_img_"]'),
function(select) {
select.click();
}
)
@roberto-butti
roberto-butti / resize.sh
Created December 3, 2019 13:22
Resize image max 64px
for i in $(ls -1 public/assets/img/markers/*.png);do convert $i -resize 64x64\> $(basename $i) ;done
@roberto-butti
roberto-butti / gist:ba9777d57320e772716c2121ea68dc1a
Last active December 2, 2019 08:46
Changing Select values as "A", for each select in page that has "id" starts with "g_"
[].forEach.call(
document.querySelectorAll('select[id^="g_"]'),
function(select) {
select.value = 'A';
}
)
@roberto-butti
roberto-butti / upgrade.sh
Last active September 16, 2019 09:27
upgrading php7 with MacPorts
#!/bin/bash
#update ports index
sudo port selfupdate
# install php version 7.0 :)
sudo port install php70
# install php 7 as apache module
sudo port install php70-apache2handler
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so
cd