Skip to content

Instantly share code, notes, and snippets.

View aboglioli's full-sized avatar
💡

Alan Boglioli aboglioli

💡
View GitHub Profile
func merge(cs ...<-chan int) <-chan int {
out := make(chan int)
var cases []reflect.SelectCase
for _, c := range chans {
cases = append(cases, reflect.SelectCase{
Dir: reflect.SelectRecv,
Chan: reflect.ValueOf(c),
})
}
@mpj
mpj / example01.js
Created August 14, 2017 07:38
Code for the async/await episode of Fun Fun Function.
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`)
const data = await response.json()
return data.imageUrl
}
@helpse
helpse / webpack.config.js
Created April 1, 2017 03:32
Webpack + dev server + hot reloading + pug + sass
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var src = path.join(__dirname, 'src');
var config = {
devServer: {
hot: true,
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@heckctor
heckctor / prepos_install.sh
Last active December 9, 2019 18:36
Script basico que descarga e instala Prepros Linux 5.10.2
#!/bin/bash
# -*- ENCODING: UTF-8 -*-
#Requiere de permisos de ejecución:$chmod -x prepros_install.sh
#Ejecutar como Root: $bash prepros_install.sh
#Validando Acceso Root
if [[ $EUID -ne 0 ]]; then
echo "Tienes que ejecutar este script como Root" 1>&2
exit 1
fi
@btroncone
btroncone / authentication.ts
Last active April 10, 2022 06:44
Angular 2 application role access decorator, wrapping built in CanAccess functionality. Prevents view transitions when user roles are not appropriate.
import { Injectable } from 'angular2/core';
import { Storage } from './storage';
import { CurrentUser } from '../interfaces/common';
@Injectable()
export class Authentication{
private _storageService : Storage;
private _userKey : string = "CURRENT_USER";
constructor(storageService : Storage){
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@NathanSweet
NathanSweet / astar for libgdx
Last active March 27, 2024 13:12
A* for libgdx that is simple but optimized, includes runnable demo. Uses a binary heap for the open list. Nodes are cached in a PathNode[], which is also used to make finding a node in the open list fast. A "run id" is used to avoid needing to clear the nodes for a new run.
// A* for libgdx that is simple but optimized.
package test;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@thegdshop
thegdshop / gist:3171026
Created July 24, 2012 16:28
WooCommerce - Add checkbox field to the checkout
<?php
/**
* Add checkbox field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my-new-field"><h3>'.__('My Checkbox: ').'</h3>';