Skip to content

Instantly share code, notes, and snippets.

View inakiarroyo's full-sized avatar
🤪

Iñaki Arroyo inakiarroyo

🤪
View GitHub Profile
@inakiarroyo
inakiarroyo / builder-pattern.dart
Last active October 16, 2022 01:13
Dart Builder pattern
class Pizza {
final String sauce;
final List<String> toppings;
final bool hasExtraCheese;
Pizza._builder(PizzaBuilder builder) :
sauce = builder.sauce,
toppings = builder.toppings,
hasExtraCheese = builder.hasExtraCheese;
}
@jodyheavener
jodyheavener / Instructions.md
Created August 18, 2015 04:55
Use Babel (ES6) with Sails JS

Inspired by this issue, with these instructions you should be able to get Babel transpiling your JS in Sails JS for the client side.

  1. Install Grunt Babel npm install --save grunt-babel
  2. Create a babel.js file under tasks/config and add something like the following:
module.exports = function(grunt) {

    grunt.config.set('babel', {
dev: {
@stevenhaddox
stevenhaddox / ds215j_provisioner.md
Last active June 16, 2018 08:35
Bootstrap Synology DS215j DSM 5.x provisioner steps

Boostrap the Synology DS215j with optware, ipkg, and sudo

Inspired mostly from the Bootstrap DS215j blog post

Download & Install ipkg in a persistent manner

# Create a directory that won't get nuked during DSM security updates
mkdir /volume1/@optware
cd /volume1/@optware
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@slavafomin
slavafomin / 0-readme.md
Last active April 4, 2020 04:29
Loop promises in Angular.js / Run list of actions sequantually

The provided example will allow you to do sequential requests to the server in Angular.js.

It will iterate all the items and call server for each item, however, if one request will fail, all sequential requests will be aborted.

If you need to call all requests no matter what, just replace promise.then() with promise.finally().

Cheers!

@kehh
kehh / change_db_owner.sh
Created October 19, 2012 01:42 — forked from sharoonthomas/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@matflores
matflores / gist:3692524
Created September 10, 2012 17:53
Fixing conflicts between Ghostscript & gs

Fixing conflicts between Ghostscript & gs

If you are using gs for managing your gem sets and you are also using any tool that relies on Ghostscript for converting PDF files to other formats (e.g. GraphicsMagick, docsplit, etc.), you may find that one of the two will fail due to a conflict between the two gs commands.

There are two possible solutions to this problem:

  • rename the gs command to something else (e.g. gset, gs_, etc), and leave Ghostscript's gs as the only gs command in your system.
  • edit GraphicMagick's delegates file and specify the full path to the gs command. This file is located in the lib/GraphicsMagick/config directory of your GraphicsMagick's installation. If GraphicsMagick was installed via homebrew, you can find the full path to this file by running brew list graphicsmagick | grep delegates.