Skip to content

Instantly share code, notes, and snippets.

View msangel's full-sized avatar
🕺
an ordinary human being

Vasyl Khrystyuk msangel

🕺
an ordinary human being
View GitHub Profile
@msangel
msangel / tryable promise.js
Last active February 25, 2016 11:45
this is function for creating tryable promise. as far as promise is not reusable, this accept promise factory, that create new promise for each try
var createTryablePromise = function (promiseFactory, tryes, delay) {
return new Promise(function (resolve, reject) {
var processOnce = function () {
promiseFactory().then(function (data) {
resolve(data);
}).catch(function (err) {
tryes--;
console.log('promise execution fail in:'+ tryes);
if(tryes>0){
if(typeof delay === 'undefined'){

Theory and history.

Regular expressions (regexp) is a formal language for searching and manipulating with substrings in text. Regular expressions is based on usage if meta-symbols (wildcard characters). This is, actually, a string pattern, which formalizing a search rule (wiki) .

There exists two kinds of regular expressions:

  • POSIX (older one, basics)
  • PCRE (perl-compatible regular expressions, more extended)
package ua.co.k.yaml2dotnotation;
import org.yaml.snakeyaml.Yaml;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
@msangel
msangel / DataAccessor.java
Created October 23, 2019 21:54
Data PropertyResolverAdapter
package liqp;
import java.util.Map;
/**
* Provide alternative to :data
* Used in some liquid transformation also used as main data storage in data model of jekyll.
*/
public interface DataAccessor {
Map<String, Object> getData();
@msangel
msangel / ToLiquid.java
Last active October 24, 2019 22:39
ToLiquid PropertyResolverAdapter
package liqp;
/**
* Provide alternative to :to_liquid
* Used in some liquid transformation.
*/
public interface ToLiquid {
Object toLiquid();
}
@msangel
msangel / ApiModule.java
Last active October 10, 2022 14:45 — forked from koesie10/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2.3.0
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()