This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const g = n => n + 1; | |
const f = n => n * 2; | |
const wait = time => new Promise( | |
(resolve, reject) => setTimeout( | |
resolve, | |
time | |
) | |
); | |
wait(300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const g = n => n + 1; | |
const f = n => n * 2; | |
const trace = label => value => { | |
console.log(`${ label }: ${ value }`); | |
return value; | |
}; | |
const doStuff = x => { | |
const afterG = g(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git reset --hard # removes staged and working directory changes | |
## !! be very careful with these !! | |
## you may end up deleting what you don't want to | |
## read comments and manual. | |
git clean -f -d # remove untracked | |
git clean -f -x -d # CAUTION: as above but removes ignored files like config. | |
git clean -fxd :/ # CAUTION: as above, but cleans untracked and ignored files through the entire repo (without :/, the operation affects only the current directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git config --global credential.helper cache | |
# Set git to use the credential memory cache | |
git config --global credential.helper 'cache --timeout=7200' | |
# Set the cache to timeout after 1 hour (setting is in seconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git config http.postBuffer 524288000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.jasongoodwin.monads.Try; | |
import org.apache.log4j.Logger; | |
import java.util.function.Function; | |
public abstract class Retrier<Tin, Tout> { | |
private static Logger logger = Logger.getLogger(WsExecuter.class); | |
private int LIMIT_OF_RETRIES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doAnswer(new Answer() { | |
public Object answer(InvocationOnMock invocation) { | |
Object[] args = invocation.getArguments(); | |
((objectToAlter)args[0]).campo1 = 1; | |
((objectToAlter)args[0]).campo2 = 2; | |
return null; | |
}}) | |
.when(xxxx).method(entry()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum ServiceErrors | |
{ | |
[ErrorDescription(10, "A data de emissão é menor que a data de movimento.", ErrorType.DadosInvalidos)] | |
DataEmissaoMenorQueMovimento, | |
[ErrorDescription(20, "Data de emissão inválida.", ErrorType.DadosInvalidos)] | |
DataEmissaoInvalida | |
} | |
public static class ServiceErrorsExtension{ | |
public static ErrorDescriptionAttribute GetErrorDescription<T>(this T serviceErrors) | |
where T : struct, IConvertible, IComparable, IFormattable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/ | |
// See also: http://www.paulund.co.uk/change-url-of-git-repository | |
$ cd $HOME/Code/repo-directory | |
$ git remote rename origin bitbucket | |
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git | |
$ git push origin master | |
$ git remote rm bitbucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static object RandomString(int length) | |
{ | |
var random = new Random((int)DateTime.Now.Ticks); | |
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
return new string( | |
Enumerable.Repeat(chars, length) | |
.Select(s => s[random.Next(s.Length)] | |
).ToArray() | |
); | |
} |
OlderNewer