Skip to content

Instantly share code, notes, and snippets.

View fernandoacorreia's full-sized avatar

Fernando Correia fernandoacorreia

View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active July 13, 2024 13:20
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@BretFisher
BretFisher / docker-for-mac.md
Last active July 9, 2024 11:29
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
@solidsnack
solidsnack / basicauth.scala
Created January 5, 2014 19:17
Basic Auth helper for Play Framework
// Call in the scope of a request handler to retrieve basic auth parameters
// if they are present.
def basicAuth()(implicit request: Request[_]): Option[(String, String)] = {
val Basic = "^ *Basic +([^ ].+)$".r
for {
auth <- request.headers.get("Authorization")
Basic(base64) <- Basic.findFirstIn(auth)
decoded <- Option(new BASE64Decoder().decodeBuffer(base64))
plain <- Option(new String(decoded, "UTF-8"))
@agile-jordi
agile-jordi / EnumJson
Last active April 22, 2016 05:06
An object with functions the create Reads, Writes or Formats for Enums.
// With an enumeration like...
// object Color extends Enumeration{...}
// Create a format (or reads or writes) like this:
// val fmt = EnumJson.enumFormat(Color);
// The implementation
object EnumJson {
def enumReads[E <: Enumeration](enum: E): Reads[E#Value] = new Reads[E#Value] {
@fernandoacorreia
fernandoacorreia / h5bp-twitter-bootstrap
Created February 2, 2012 00:31 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
#!/usr/bin/env bash
src=$PWD
ant_build_script_remote=https://github.com/h5bp/ant-build-script.git
h5bp_remote=git://github.com/h5bp/html5-boilerplate.git
bootstrap_remote=git://github.com/twitter/bootstrap.git
ant_build_script_branch=master
h5bp_branch=master
@dideler
dideler / bootstrapping.md
Last active May 8, 2024 14:38
Bootstrapping - a list of useful resources to get up and running quickly

Welcome!

UPDATE: This list is no longer maintained. I've moved it to its own repo so you can send suggestions as Pull Requests. https://github.com/dideler/bootstrapping/

For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.

Starring this gist will give me an idea of how many people consider this list useful.

@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js