Skip to content

Instantly share code, notes, and snippets.

View devmaufh's full-sized avatar
💻
Learning

Mauricio Flores Hernández devmaufh

💻
Learning
  • Backbone systems
  • Celaya, Guanajuato, México
View GitHub Profile
@bradtraversy
bradtraversy / carbon-lang-snippets.md
Last active March 21, 2024 11:31
Google Carbon Snippets

Google Carbon Snippets

This file contains some of the basic syntax for Google Carbon as well as some info and how to get set up.

The official repo and docs can be found at: https://github.com/carbon-language/carbon-lang

Carbon is an experimental successor to C++. It is NOT ready for production and will not be for a while. This crash course and document were made to explore some of the basic syntax.

How to get started

@miken32
miken32 / Cidr.php
Last active October 24, 2023 07:27
Laravel CIDR validation rule
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use const FILTER_FLAG_IPV4;
use const FILTER_FLAG_IPV6;
use const FILTER_VALIDATE_INT;
@alejamp
alejamp / curp.dart
Last active November 22, 2023 19:47
Dart Mexican CURP Validation
void main() {
var res = CURP.curpValida('XXXXXXXXXXXXX');
print("Result:" + res.toString());
}
class CURP {
@davidpiesse
davidpiesse / Schedulable.php
Last active September 7, 2023 15:22
Laravel Custom Class/Model Scheduling
<?php
//Don't forget to change the namespace!
namespace App\Traits;
use Cron\CronExpression;
use Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ManagesFrequencies;
trait Schedulable{
@cmoulton
cmoulton / Simple Alamofire Calls in Swift 4
Last active December 8, 2020 09:29
Simple Alamofire Calls in Swift 4
import Alamofire
func makeGetCallWithAlamofire() {
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
Alamofire.request(todoEndpoint)
.responseJSON { response in
// check for errors
guard response.result.error == nil else {
// got an error in getting the data, need to handle it
print("error calling GET on /todos/1")
@roalcantara
roalcantara / git_push_to_remote_with_pem_auth.sh
Last active January 24, 2020 02:42
Git push to remote with pem authentication
# generate public/private keys using ssh-keygen
ssh-keygen -t rsa
# change the permissions of the .pem file so only the root user can read it
chmod 400 amazon-generated-key.pem
# copy the machine to the remote repository
ssh-copy-id -i ~/.ssh/id_rsa.pub amazon-generated-key.pem ec2-user@amazon-instance-public-dns
# or
@geedelur
geedelur / git-flow_windows.textile
Created July 30, 2012 16:31
Git-flow Windows Install
@wyanez
wyanez / no-delete.sql
Created June 29, 2012 15:02
[PLPGSQL] Evitar el borrado de registros en una tabla de postgres
CREATE OR REPLACE FUNCTION proteger_datos() RETURNS TRIGGER AS $proteger_datos$
DECLARE
BEGIN
--
-- Esta funcion es usada para proteger datos en un tabla
-- No se permitira el borrado de filas si la usamos
-- en un disparador de tipo BEFORE / row-level
--