Skip to content

Instantly share code, notes, and snippets.

View luis-fss's full-sized avatar
:octocat:
Hey

Luis Fernando de Souza Santos luis-fss

:octocat:
Hey
View GitHub Profile
@luis-fss
luis-fss / SteinAlgorithm.cs
Created January 8, 2012 01:15
greatest common divisor (GCD) for a pair of integers using the Stein's algorithm
public static uint Stein(uint value1, uint value2)
{
if (value1 == 0) return value2;
if (value2 == 0) return value1;
if (value1 == value2) return value1;
bool value1IsEven = (value1 & 1u) == 0;
bool value2IsEven = (value2 & 1u) == 0;
if (value1IsEven && value2IsEven)
@luis-fss
luis-fss / convertUTF8toISO-description.txt
Created March 1, 2012 20:48
Convertendo de UTF-8 para ISO-8859-1 em Java: A solução definitiva
Recentemente enfrentei problemas em um aplicativo Android que desenvolvi, o qual se comunica com o banco de dados de um dos sistemas da empresa, codificado em ISO-8859-1 (Firebird) através de um web service.
Os dados eram gravados de forma errada, muitas vezes truncavam e as vezes apareciam caracteres estranhos.
Depois de algumas tentativas, cheguei até a seguinte solução:
@luis-fss
luis-fss / timestamp.py
Created November 16, 2012 12:16 — forked from robcowie/timestamp.py
Insert date and time stamps in Sublime Text 2
# -*- coding: utf-8 -*-
from datetime import datetime
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
"""
@luis-fss
luis-fss / NugetCommandLineTips.txt
Created November 18, 2015 23:49
Nuget command line tips
Nuget command line – uninstall package from all projects
> Get-Project -All | Uninstall-Package <package name>
@luis-fss
luis-fss / testar cores em javascript.js
Last active March 16, 2016 03:00
testar cores em javascript
// testar cores em javascript
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
@luis-fss
luis-fss / git --allow-unrelated-histories
Created January 21, 2019 12:59
How to resolve github refusing to merge unrelated histories
C:\[path]\git.exe merge origin/master --allow-unrelated-histories
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@luis-fss
luis-fss / build.cake
Created January 28, 2019 13:25
Aquivo build.cake (ainda em desenvolvimento) preparado para gerar pacotes ClickOnce e controle de versão
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
//#addin nuget:?package=Cake.ClickTwice
#addin nuget:?package=Cake.Powershell&version=0.4.7
#r "C:\Users\lukia\source\repos\Cake\ClickTwice\src\Cake.ClickTwice\bin\Debug\Cake.ClickTwice.dll"
#r "C:\Users\lukia\source\repos\Cake\ClickTwice\src\Cake.ClickTwice\bin\Debug\ClickTwice.Handlers.AppDetailsPage.dll"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
@luis-fss
luis-fss / SetAssemblyInfoVersion.ps1
Created January 28, 2019 13:27
PowerShell script to set the version in all the AssemblyInfo.cs or AssemblyInfo.vb files in any subdirectory
# SetAssemblyInfoVersion.ps1
#
# Set the version in all the AssemblyInfo.cs or AssemblyInfo.vb files in any subdirectory.
#
# usage:
# from cmd.exe:
# powershell.exe .\SetAssemblyInfoVersion.ps1 2.8.3.0
#
# from powershell.exe prompt:
# .\SetAssemblyInfoVersion.ps1 2.8.3.0
@luis-fss
luis-fss / gulpfile.js
Created April 28, 2020 14:03
NPM and Gulp for Asp.Net Core 3 config sample
/// <binding AfterBuild='default' Clean='clean' />
/*
This file is the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require('gulp');
var del = require('del');
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');