Skip to content

Instantly share code, notes, and snippets.

View gbaldera's full-sized avatar
🏠
Working from home

Gustavo Rodriguez Baldera gbaldera

🏠
Working from home
View GitHub Profile
@gbaldera
gbaldera / FormReaderExtensions.cs
Created March 15, 2019 00:35 — forked from davidfowl/FormReaderExtensions.cs
FormReader prototype
public static class FormReaderExtensions
{
public static async ValueTask<IFormCollection> ReadFormAsync2(this HttpRequest request)
{
var reader = request.BodyPipe;
KeyValueAccumulator accumulator = default;
while (true)
{
var result = await reader.ReadAsync();
@gbaldera
gbaldera / nodejs-tcp-example.js
Created January 3, 2018 14:03 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@gbaldera
gbaldera / iterm2-solarized.md
Created July 23, 2017 22:23 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@gbaldera
gbaldera / git.migrate
Created December 30, 2016 15:36 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@gbaldera
gbaldera / Deploy-Windows-Service-Via-MSBuild.proj.xml
Created December 1, 2016 21:56 — forked from mrchief/Deploy-Windows-Service-Via-MSBuild.proj.xml
MSBuild Script to deploy Windows Service to remote or local machine
<Project DefaultTargets="CopyOutputs;DeployService" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- These settings control what the service's name, description etc appear in services.msc task panel. -->
<PropertyGroup Label="ServiceMetaData">
<ServiceName>ShinyNewService</ServiceName>
<ServiceDisplayName>Shiny New Service</ServiceDisplayName>
<ServiceDescription>A shiny new service, that changes the world for the greater good.</ServiceDescription>
</PropertyGroup>
<Choose>
@gbaldera
gbaldera / config-webhooks.php
Created June 15, 2016 15:05
ASP.NET WebHooks PHP (Codeigniter) Custom Receiver
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Secret Key
|--------------------------------------------------------------------------
|
| The secret used to sign the body of the WebHook request
|
*/
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.github.manuelpeinado.toolbartest;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.View;
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:colorForeground">#440000</item>
<item name="android:colorForegroundInverse">#004400</item>
<item name="android:colorBackground">#444400</item>
<item name="android:colorBackgroundCacheHint">#440044</item>
<item name="android:textColorPrimary">#FFFF00</item>