Skip to content

Instantly share code, notes, and snippets.

View enricopolanski's full-sized avatar

Enrico Polanski enricopolanski

View GitHub Profile

// VALUES AND DATA TYPES Values are information with a type. JavaScript primitive types:

  • Number is a double-precision 64-bit floating point format (IEEE 754). Also NaN and Infinity, -Infinity
  • Boolean, true or false
  • String, strings
  • null
  • undefined
  • Symbol
export default class Foo extends Vue {
@State(state => state.someData) someData!: SomeDataType
@Mutation('setFormData') setFormData
originalData!: SomeDataType
get id() {
return this.someData.id
}
set id(value) {
@enricopolanski
enricopolanski / giulio-functional-message-dump.md
Created March 18, 2019 11:15 — forked from zanza00/giulio-functional-message-dump.md
Dump di quando detto da @gcanti nel canale #fp di italiajs in data 1 marzo 2019

Questa non è farina del mio sacco, io ho solo copia incollato la discussione. Kudos to Giulio Canti

@vncz ho un consiglio su come procedere a strutturare un programma funzionale, con me ha funzionato bene, vediamo se funziona anche per te

In linea teorica e generale procedo così

  • dominio
  • firma del programma
  • firme delle operazioni di base
@enricopolanski
enricopolanski / deleteUsersScript.groovy
Created December 20, 2018 09:20
Groovy script to delete users based on a text/csv file in Liferay 6.2
import com.liferay.portal.service.UserLocalServiceUtil
// path to file. e.g. *nix: "/Users/user/Documents/foldercsv/file.csv", e.g. windows: "C:\documents\foldercsv\file.csv"
def String filePath = "/path/to/file.csv"
def String separator = "separator"
// 0-index based column of companyId and email
def int emailIndex = // int
def int companyIdIndex = // int
{
"name": "angular",
"version": "0.0.0",
"private": true,
"dependencies": {
"@angular/common": "^7.0.1",
"@angular/compiler": "^7.0.1",
"@angular/core": "^7.0.1",
"@angular/forms": "^7.0.1",
"@angular/platform-browser": "^7.0.1",
// src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MainMenuComponent } from 'app/components/main-menu/main-menu.component';
import { BoardComponent } from './components/board/board.component';
export default function (columnIndex, playerTurn, oldGrid) {
// find the index of an empty (null) row
const emptyRowIndex = oldGrid[columnIndex].findIndex(el => el === null);
if (emptyRowIndex === -1) { return }
const newGrid = oldGrid.map( (col, i) => {
// return the same old columns, same for columnIndex
return i === columnIndex ? col.map((row, j) => {
import { h, Component } from 'preact';
import firebaseConfig from '../../configs/firebaseConfig'
/** @jsx h */
/* global firebase */
class App extends Component {
constructor(props){
super(props);
this.state = {
password: ''
class App extends React.Component {
// You need to define the state in the constructor
constructor(props) {
super(props);
this.state = {
username: '', // why would Username and Password be booleans?
password: ''
}
this.closeLogin = this.closeLogin.bind(this);
// foo.js
export default ()=>{
console.log(this);
}
// Bar.js
import foo from 'foo'
class Bar {