Skip to content

Instantly share code, notes, and snippets.

View reinaldorauch's full-sized avatar
🤙

Reinaldo Antonio Camargo Rauch reinaldorauch

🤙
View GitHub Profile
@takanuva
takanuva / agt.h
Last active July 25, 2022 19:57
Simple generic print() and scan() macros
/*******************************************************************************
* Copyright 2022 Paulo Torrens *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy *
* of this software and associated documentation files (the "Software"), to *
* deal in the Software without restriction, including without limitation the *
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or *
* sell copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@gobinathm
gobinathm / shallow_update_git.md
Created March 6, 2017 18:24
Fix for Remote rejected shallow update not allowed after changing Git remote URL

Some Time there is a shallow update not allowed issue in your cloned GIT repo.

This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add origin <path-to-old-remote> After that we use git fetch to fetch the remaining history from the old remote (as suggested in this answer).

git fetch --unshallow origin And now you should be able to push into your new remote repository.

import Data.List
media :: Fractional a => [a] -> a
media l = sum l / (fromIntegral $ length l)
desvios :: Fractional a => [a] -> a -> [a]
desvios xs m = map (subtract m) xs
powtwo :: Fractional a => [a] -> [a]
powtwo = map (^2)
@SimonSimCity
SimonSimCity / pagination.html.twig
Last active September 30, 2023 17:29
A gist for pagination in Twig, based on the total number of pages, the current page and some URL-settings.
{#
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/
Updated by: Simon Schick <simonsimcity@gmail.com>
Parameters:
* currentFilters (array) : associative array that contains the current route-arguments
* currentPage (int) : the current page you are in
* paginationPath (string) : the route name to use for links
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled)
* lastPage (int) : represents the total number of existing pages