Skip to content

Instantly share code, notes, and snippets.

View gonzaloserrano's full-sized avatar
☁️
🧑‍💻

Gonzalo Serrano gonzaloserrano

☁️
🧑‍💻
View GitHub Profile
@ecoleman
ecoleman / gist:1525027
Created December 27, 2011 20:26
hide php variables in tagbar.vim
let g:tagbar_type_php = {
\ 'ctagstype' : 'php',
\ 'kinds' : [
\ 'i:interfaces',
\ 'c:classes',
\ 'd:constant definitions',
\ 'f:functions',
\ 'j:javascript functions:1'
\ ]
@omnidan
omnidan / PrettyJsonResponse.php
Last active July 17, 2019 12:48
Pretty-printed Symfony JsonResponse class. 100% compatible with the original class, requires PHP 5.4.0 or higher.
<?php
/**
* @license WTFPL (Do What the Fuck You Want to Public License)
* @author Daniel Bugl <daniel.bugl@touchlay.com>
*/
namespace TouchLay\HelperBundle\Component;
use Symfony\Component\HttpFoundation\JsonResponse;
@acolyer
acolyer / service-checklist.md
Last active June 20, 2024 08:47
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active May 15, 2024 10:52
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

How to calculate your hourly rate as a freelancer?

Many people struggle with this question. Some just try to make as much as a full-time employee makes (and ignore that they won't be able to bill as many days). Others follow tips on startup related websites that suggest to ask for 20% to 50% more than an salary would yield (and ignore the additional risk and expenses they have).

Below you will find some numbers to help you calculate how high your hourly or daily rate should be.

Your yearly income should be higher than an average salary

  • You take more risk than full time employees, phases without income are likely

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@davidalger
davidalger / sysadmin-shortcuts.md
Last active February 2, 2024 09:17
sysadmin-shortcuts

list listening ports

sudo lsof -nP -iTCP -sTCP:LISTEN
sudo netstat -plunt

flush DNS on Mojave

sudo killall -HUP mDNSResponder

immediately sleep displays

@am
am / layersToArtboards.jsx
Last active December 12, 2018 20:57
Illustrator util to copy layers content to artboards
// based on https://github.com/michaelchaize/appliness/blob/master/Illustrator-create-artboards/CreateArtboardsLayers.jsx
// Illustrator util to copy layers content to artboards
// Each layer must contain one single group
// It will name the artboard to match the layer name
// For each 20 layers it creates a new row
// Ensure the original artboard is placed in the top left corner
// TODO: translate the original artboard on the top left corner
package domain
// An Aggregate is a tree of object relations that protect business invariants (business rules).
// Concretely, an aggregates handle commands and have a state model encapsulated within it that allows
// it to implement the required command validation, thus upholding the invariants (business rules) of the aggregate.
// Aggregates are usually composed of several entities and values objects.
// The lifetimes of the components of an aggregate are bounded by the lifetime of the entire aggregate.
// Aggregate is abstract concept, it's just represented as an empty interface with no specific contract.
type Aggregate interface{}

You can use Ellie to "test" the code, changing only the result function and adding your extra code

Extra documentation to use this as reference:

Data Modeling exercises

1 - Represent a package containing:

  • barcode