Skip to content

Instantly share code, notes, and snippets.

View DanyelMorales's full-sized avatar
🦆
#stayHome

Daniel V Morales DanyelMorales

🦆
#stayHome
  • Software Engineer
  • San Antonio, Texas
View GitHub Profile
@DanyelMorales
DanyelMorales / Gruntfile.js
Created June 25, 2018 17:14
Precompile scss to css
var root = "./assets";
var publicPath = "./public/assets";
var cssPath = publicPath + "/css/";
var jsPath = publicPath + "/js/";
var htmlDevelopmentFiles = ['./app/views/**/*.html'];
var sass = {
source: root + '/css/',
dest: cssPath,
pattern: "**/*.scss"
@DanyelMorales
DanyelMorales / DesktopNotification.ts
Created May 17, 2018 22:42
Desktop notifications simple implementation
/**
* Interfaz para acceder a notificaciones desktop
*
* DesktopNotification.$show("Hey", {
* body: `you have ${totalDisplayed} tasks to do`,
* icon: '/yourlogo.png'
* });
* @author Daniel Vera Morales
*/
export class DesktopNotification {
import { JSONType } from "./IJsonType";
/**
* Filtra un resultado de modo que se pueda modificar.
*/
export class SimpleFilter<K> {
protected filters: JSONType<K, (data) => any>;
constructor() {
this.filters = new JSONType<K, (data) => any>();
}
@DanyelMorales
DanyelMorales / logencode.py
Last active May 5, 2018 15:38
Python3 custom encode algorithm using mathematical logarithms (highly insecure)
import math
import base64
import functools
text="hola";
base=len(text);
acum=[];
for x in text:
mychr=math.log(ord(x), base);
encoded=str(mychr);
enc2="";
@DanyelMorales
DanyelMorales / docker_gitlab.sh
Created May 1, 2018 22:58
install gitlab container for docker
#!/usr/bin/env bash
container="gitlab";
base="PATH_TO_YOUR_HOME/gitlab";
config=$base"/config";
logs=$base"/log";
data=$base"/data";
docker run --detach --publish 443:443 --publish 8580:80 --publish 8522:22 --name $container --restart always --volume $config:/etc/gitlab --volume $logs:/var/log/gitlab --volume $data:/var/opt/gitlab gitlab/gitlab-ce:latest
@DanyelMorales
DanyelMorales / AbstractTestCommon.java
Last active August 22, 2018 15:57
JAVA DROPWIZARD 0.7 example for common test utils
package anyp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Set;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@DanyelMorales
DanyelMorales / FooTest.java
Created April 19, 2018 17:45
Junit Rule to save ORACLE SEQUENCES
class FooTest {
/**
* Sequence saving
*/
public static SequenceJunitRule sequences = new SequenceJunitRule();
/**
* Restore the sequences on Class DIE.
*/
@AfterClass
public static void tearDownClass() {
@DanyelMorales
DanyelMorales / Curry.js
Created April 9, 2018 14:56
Curry stable method for javascript and Typescript.
// Define new methods, function helper
Function.method = function(name, fx) {
this.prototype[name] = fx;
};
// Define curry method
Function.method("curry", function() {
const slice = Array.prototype.slice;
const args = slice.apply(arguments);
const that = this;
@DanyelMorales
DanyelMorales / getterbuild.ts
Created March 13, 2018 17:22
Create getter on the flow
function createMethod(name: string, value: string, parent, theContext) {
const getter = function() {
parent.endpoint = value;
return parent.endpoint;
};
Object.defineProperty(theContext, name, {
get: getter,
enumerable: true,
configurable: true
@DanyelMorales
DanyelMorales / jwtRS256.sh
Created February 28, 2018 16:14 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub