Skip to content

Instantly share code, notes, and snippets.

View JonathanLoscalzo's full-sized avatar

Jonathan Loscalzo JonathanLoscalzo

View GitHub Profile
@JonathanLoscalzo
JonathanLoscalzo / App.js
Created June 27, 2018 02:43
filterable input - react
import React from 'react';
class App extends React.Component {
constructor(){
super();
this.state = {items: []}
}
componentWillMount(){
fetch( 'https://swapi.co/api/people/?format=json' )
.then( response => response.json() )
.then( ({results: items}) => this.setState({items}))
@JonathanLoscalzo
JonathanLoscalzo / gist:ff2f1ec1a9bf1422eb18482eae23cddf
Created July 19, 2018 18:27 — forked from julianlam/expose-directory-on-host-to-lxc-container.md
Exposing a directory on the host machine to an LXC container

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@JonathanLoscalzo
JonathanLoscalzo / codigo.sh
Created August 12, 2018 21:55
problemas red docker en ubuntu cuando no funciona netmanager
sudo ifconfig vboxnet0 up
@JonathanLoscalzo
JonathanLoscalzo / ejecutar.sh
Created August 12, 2018 21:58
problema red en ubuntu, reiniciar netmanager
sudo service network-manager restart
<Customer>
<CustomerID>ALFKI</CustomerID>
<CompanyName>Alfreds Futterkiste</CompanyName>
<ContactName>Maria Anders</ContactName>
<ContactTitle>Sales Representative</ContactTitle>
<Address>Obere Str. 57</Address>
<City>Berlin</City>
<PostalCode>12209</PostalCode>
<Country>Germany</Country>
<Phone>030-0074321</Phone>
@JonathanLoscalzo
JonathanLoscalzo / paginated.js
Created September 2, 2018 00:01 — forked from jstott/paginated.js
lodash paginated items
function getPaginatedItems(items, page, pageSize) {
var pg = page || 1,
pgSize = pageSize || 100,
offset = (pg - 1) * pgSize,
pagedItems = _.drop(items, offset).slice(0, pgSize);
return {
page: pg,
pageSize: pgSize,
total: items.length,
total_pages: Math.ceil(items.length / pgSize),
@JonathanLoscalzo
JonathanLoscalzo / frontend.js
Created October 30, 2018 12:27
In asp.net mvc, download a file as StreamContent
function print(sells) {
return $http.get("URL", {
params: { ids: sells }, responseType: "arraybuffer"
})
.then(function (res) {
var linkElement = document.createElement('a');
try {
var blob = new Blob([res.data], { type: 'application/octet-stream' });
var url = window.URL.createObjectURL(blob);
@JonathanLoscalzo
JonathanLoscalzo / TimeSpanExtensions.cs
Last active February 6, 2019 15:03
CalculateTimeBetween.cs How to calculate time between. For example: attention span
public static class TimeSpanExtensions
{
private static IFormatProvider GetCulture()
{
return CultureInfo.CreateSpecificCulture("es-AR");
}
public static string ToViewString(this TimeSpan? time)
{
if (time != null)
@JonathanLoscalzo
JonathanLoscalzo / PConcurrente.md
Last active February 8, 2019 00:54 — forked from Titinx/PConcurrente.md
Apuntes Concurrente

Programación Concurrente 2015

Apuntes de Programación Concurrente, Facultad de Informatica, UNLP. Promoción teorica 2015 - febrero.

Teoria 1

##Qué es la concurrencia?