Skip to content

Instantly share code, notes, and snippets.

View marcoslin's full-sized avatar

Marcos Lin marcoslin

View GitHub Profile
@marcoslin
marcoslin / apache-beam-iterable-ctx.kt
Last active July 13, 2021 21:00
Kotlin Apache Beam and Iterable
package app.fp8.beam
import org.apache.beam.sdk.Pipeline
import org.apache.beam.sdk.transforms.Create
import org.apache.beam.sdk.transforms.DoFn
import org.apache.beam.sdk.transforms.ParDo
import org.apache.beam.sdk.values.KV
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions as assert
@marcoslin
marcoslin / printer.kts
Last active April 7, 2021 13:32
Sample Kotlin Script Illustrating how to write a custom Kotlin DSL
#!/usr/bin/env kscript
/**
* Define a Printer class that will prefix the message with given
* symbol and apply a `postfix` to the end of the message.
*
* The methods will be available for the inline function
*/
class Printer(private val postfix: String) {
fun asterix(message: String) {
@marcoslin
marcoslin / server.sh
Last active August 12, 2017 05:59
Generic Bash File to start and stop scripts using nohup and pid file
#!/bin/bash
#
# Generic file to start and stop server using nohup and pid file
#
# Author: Marcos Lin
# Date: 15 Dec 2014
# License: MIT License
#
@marcoslin
marcoslin / jswat.js
Created June 21, 2014 12:06
Truthy (b==1 && b==2 & b==3)
var b = {}, priv = 0;
b.valueOf = function () {
return priv += 1;
}
if ( b==1 && b==2 & b==3 ) {
console.log("This can only be true in JS!!!"); // This works!!!
}
@marcoslin
marcoslin / _.md
Last active November 28, 2017 09:33
ui-router: Lazy Loading State

Lazy Load States

Sample code for on how to lazy load state for ui-router

@marcoslin
marcoslin / app.js
Last active October 8, 2021 08:52
Simple angularAMD Sample
define(['angularAMD', 'angular-route'], function (angularAMD) {
var app = angular.module("webapp", ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider
.when("/home", angularAMD.route({
templateUrl: 'view_home.html', controller: 'HomeCtrl', controllerUrl: 'controller_home'
}))
.when("/view1", angularAMD.route({
templateUrl: 'view_view1.html', controller: 'View1Ctrl', controllerUrl: 'controller_view1'
@marcoslin
marcoslin / app.js
Last active August 29, 2015 14:01
Simple AngulaJS MustacheTemplater
var app = angular.module("webapp", []);
/**
* MustacheTemplater is a simple and small templating designed to
* generate simple text containing mustache quoated params. The template
* is defined using <script> tag with type of "text/ng-template".
*
* It is intentionally kept simple supporting only key value pares. Need
* additional logic? Use the mustache library instead.
*
@marcoslin
marcoslin / README.md
Created May 12, 2014 14:48
netreset.sh

netreset.sh

Script used unload and load usb driver in Mac for Asix AX88179 based Network adapter.

@marcoslin
marcoslin / .gitignore
Last active August 31, 2023 15:37
Encryption: From PyCrypto to CryptoJS
source.sh