Skip to content

Instantly share code, notes, and snippets.

View ldmarz's full-sized avatar
💯
Dandolo todo mientras me divierto

Lenin martinez ldmarz

💯
Dandolo todo mientras me divierto
View GitHub Profile
constructor($ngRedux) {
'ngInject';
this.$ngRedux = $ngRedux;
$ngRedux.connect(this.mapStateToThis, actions)(this);
}
mapStateToThis(state) {
return {
currentActive: state.listReducer.currentActive
};
goUpIndex() {
this.$ngRedux.dispatch({ type: GOUP});
}
setElements(elements) {
this.$ngRedux.dispatch({ type: ELEMENTS, elements });
}
goDownIndex() {
this.$ngRedux.dispatch({ type: GODOWN });
$ npm i fuse-operators
// Data example
const mockData = [
{
"title": "Old Man's War",
"author": {
"firstName": "John",
"lastName": "Scalzi"
}
},
{
const query = 'old man && scalzi';
const result = fuseWithOperators(query, mockData);
// → [{"title": "Old Man's War", "author": {"firstName": "John", "lastName": "Scalzi"}}]
const query = 'old man || artist';
const result = fuseWithOperators(query, mockData);
// → [{"title": "Old Man's War", "author": {"firstName": "John", "lastName": "Scalzi"}}, {"title": "The Lock Artist", "author": {"firstName": "John", "lastName": "Hamilton"}}]
const query = 'old man || the lock artist > scalzi';
const result = fuseWithOperators(query, mockData);
// → [{"title": "Old Man's War", "author": {"firstName": "John", "lastName": "Scalzi"}}]
@ldmarz
ldmarz / main.java
Created October 9, 2018 15:43
Get arbitrary resources from a .war file JAVA
// Get string path from some resource
getClass().getResource('Some name resource').getPath()
// Get the resource can be as stream
getClass().getResource('some resource')
// Print where is the resource folder inside .war package
getClass().getResource('').getPath()
var commands = CommandConfig.default()
commands.useFluentCommands()
services.register(commands)
import FluentPostgreSQL
import Vapor
struct AddFieldMock: Migration {
typealias Database = PostgreSQLDatabase
static func prepare( on connection: PostgreSQLConnection ) -> Future<Void> {
return Database.update(Acronym.self, on: connection) { builder in
builder.field(for: \.someFIeld)
}