Skip to content

Instantly share code, notes, and snippets.

View bsorrentino's full-sized avatar
💭
passion is fuel for life

bsorrentino bsorrentino

💭
passion is fuel for life
View GitHub Profile
@bsorrentino
bsorrentino / 0_reuse_code.js
Created October 21, 2013 16:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
//
// How to use:
//
// 1. Start node:
// node nodeproxy.js
// 2. Send a URL like this:
// http://localhost:8080/http://www.google.com
//
// Watch www.google.com come through your local HTTP proxy.
//
// ### removeRecursive, copyRecursive when/promise compliant
// NodeJS:
// Delete a file or delete a DIR recursively
// be aware that this is a power full delete function
// so best is to check if the PATH given is really
// the path you want to DELETE ENTIRELY
//
// Copy DIR to another location recursively
//
// ### usage example
import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}
@bsorrentino
bsorrentino / Rx.java
Created July 1, 2016 05:26 — forked from bduisenov/Rx.java
gwt jsinterop for Rx.js
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsType;
/**
* Created by bduisenov on 15/12/15.
*/
public class Rx {
@FunctionalInterface
@bsorrentino
bsorrentino / cordova-plugin-guide.md
Last active September 11, 2023 13:43 — forked from mlynch/cordova-plugin-guide.md
Cordova Plugin Developer Guide

Cordova Plugin Development Guide for Android

Cordova Plugins are the magic that enable our mobile web app content to access the full power of Native SDKs underneath, but through clean JavaScript APIs that work the same across all platforms we target.

This simple guide, walks through the what, when, why, and how of Cordova plugin development for Android.

Introduction

Before start, understand their

@bsorrentino
bsorrentino / appify.sh
Last active March 31, 2022 12:43 — forked from advorak/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
appify v3.0.0 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
Note that you cannot rename appified apps. If you want to give your app
a custom name, use the second argument:
`basename "$0"` my-script.sh "My App"
@bsorrentino
bsorrentino / rxjs-patching.js
Created January 21, 2017 07:52 — forked from ericelliott/rxjs-patching.js
Reduce bundle size with RxJS patching
import { Observable } from 'rxjs/Observable';
// then patch import only needed operators:
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/from';
const foo = Observable.from([1, 2, 3]);
foo.map(x => x * 2).subscribe(n => console.log(n));
@bsorrentino
bsorrentino / docker_desc.sh
Created April 3, 2018 21:33 — forked from mlinhard/docker_desc.sh
Shell script to find docker image descendants
#!/bin/bash
parent_short_id=$1
parent_id=`docker inspect --format '{{.Id}}' $1`
get_kids() {
local parent_id=$1
docker inspect --format='ID {{.Id}} PAR {{.Parent}}' $(docker images -a -q) | grep "PAR ${parent_id}" | sed -E "s/ID ([^ ]*) PAR ([^ ]*)/\1/g"
}
print_kids() {
@bsorrentino
bsorrentino / config-props.md
Created August 24, 2018 14:18 — forked from dsyer/config-props.md
Notes on Dynamic Configuration Properties

Dynamic Configuration Properties in Spring Boot and Spring Cloud

TL;DR

  • Use @ConfigurationProperties and always get state from the bean.
  • The Environment can change at runtime and Spring Cloud does this for you using RefreshEvent.
  • Changes are propagated to beans in Spring Cloud in 2 ways (@ConfigurationProperties and @RefreshScope).
  • If you care about the state of @ConfigurationProperties being consistent on concurrent access, put it or the consumer @Bean in @RefreshScope.

Typical Scenarios