Skip to content

Instantly share code, notes, and snippets.

Avatar
🕺
an ordinary human being

Vasyl Khrystyuk msangel

🕺
an ordinary human being
View GitHub Profile
@msangel
msangel / DataAccessor.java
Created Oct 23, 2019
Data PropertyResolverAdapter
View DataAccessor.java
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 Oct 24, 2019
ToLiquid PropertyResolverAdapter
View ToLiquid.java
package liqp;
/**
* Provide alternative to :to_liquid
* Used in some liquid transformation.
*/
public interface ToLiquid {
Object toLiquid();
}
View Yaml2Props.java
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;
View gist:e171ba1ee6c3a9b2ac3328fc8d356bf4

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)
@msangel
msangel / ApiModule.java
Last active Jul 27, 2019 — forked from koesie10/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2.3.0
View ApiModule.java
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@msangel
msangel / tryable promise.js
Last active Feb 25, 2016
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
View tryable promise.js
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'){