Skip to content

Instantly share code, notes, and snippets.

View mgenov's full-sized avatar

Miroslav Genov mgenov

View GitHub Profile
@mgenov
mgenov / auth.js
Created September 13, 2017 18:00
return new Promise((resolve, reject) => {
Linking.openURL(url.join(''))
.then(() => {
const handleUrl = url => {
if (!url || url.indexOf('fail') > -1) {
reject(url)
} else {
resolve(url)
}
}
@mgenov
mgenov / fileserver.go
Created August 31, 2017 10:49
Simple file
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
'use strict';
const b64toBlob = (b64Data, contentType='', sliceSize=512) => {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
@mgenov
mgenov / .zshrc
Created February 12, 2017 18:46
export ZSH=/Users/mgenov/.oh-my-zsh
ZSH_THEME="cloud"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
static class Question {
private String name;
private String status;
private String module;
public Question(String name, String status, String module) {
this.name = name;
this.status = status;
this.module = module;
@mgenov
mgenov / index.js
Last active January 5, 2017 14:29
webpack + index.js
import angular from 'angular'
/**
* `require` all modules in the given webpack context
*/
function requireAll(context) {
context.keys().forEach(context);
}
// Collect all angular modules
requireAll(require.context(
@mgenov
mgenov / Matchers.java
Created December 8, 2016 12:15
Sitebricks Matchers
@Test
public void fetchCustomers() throws Exception {
final User anyAdminUser = newUser().markAsAdmin().build();
context.checking(new Expectations() {{
oneOf(userSecurity).currentUser();
will(returnValue(anyAdminUser));
oneOf(customerBase).fetchCustomers();
@mgenov
mgenov / Jetty.java
Created December 5, 2016 07:13
Jetty Server using Guice
public class Jetty {
private final Server server;
public Jetty(int port) {
this.server = new Server(port);
}
public void start() {
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
@mgenov
mgenov / test.html
Created November 1, 2016 12:22
Test HTML Page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Title of the document</title>
<script type="text/javascript">
var count = 0;
function handleClick() {
console.log("Count: " + count)
count++;