Skip to content

Instantly share code, notes, and snippets.

View mcallegari10's full-sized avatar
🎮

Martín Callegari mcallegari10

🎮
  • Buenos Aires, Argentina
View GitHub Profile
@mcallegari10
mcallegari10 / particleGenerator.js
Created October 26, 2020 21:24
Old particle Generator for the Wolox landing page
function* generateNewParticles() {
let randoms = [],
particles = []
while (true) {
randoms = [random(), random(), random()]
particles = [0, 0, getRandomFloat(-500, -200)]
yield { randoms, particles }
}
}
@mcallegari10
mcallegari10 / particlesGeometry.js
Created October 20, 2020 19:56
Particles Geometry
const particlesGeometry = new THREE.BufferGeometry()
const particlesVertices = []
const particlesRandoms = []
const flyingParticles = 150
let isPlaying = false
let animFrame = null
const offscreenLimit = 100
const particleAcceleration = 0.002
@mcallegari10
mcallegari10 / createPointMaterial.js
Created October 20, 2020 19:54
Particle Material
export function createPointMaterial(size, opacity = 1) {
const matCanvas = document.createElement('canvas')
matCanvas.width = size
matCanvas.height = size
const matContext = matCanvas.getContext('2d')
const texture = new CanvasTexture(matCanvas)
const center = size / 2
matContext.beginPath()
matContext.arc(center, center, size / 2, 0, 2 * Math.PI, false)
matContext.closePath()
cons AsyncRoute = () => import('./screens/AsyncRoute.vue')
const router = new VueRouter({
routes: [
{ path: '/async', component: AsyncRoute }
]
})
import Vue from 'vue'
import Navbar from '../../components/Navbar'
const AsyncComponent = () => import('../../components/AsyncComponent')
const vm = new Vue({
el: '#app',
// ... all attributes necessary for your instance
components: { Navbar, AsyncComponent }
import { RouterModule, Routes, PreloadAllModules } from @angular/router;
// You can say to Angular the route is async with the hash at the end of the import
export const ROUTES: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'dashboard' },
{ path: 'dashboard', loadChildren: '../dashboard/dashboard.module#DashboardModule' },
{ path: 'settings', loadChildren: '../settings/settings.module#SettingsModule' },
{ path: 'reports', loadChildren: '../reports/reports.module#ReportsModule' }
];
import React from 'react';
// We can use react-loadable to cover the most possibles outcomes of the code splitting
import Loadable from 'react-loadable';
// My Loader component
import Loader from '@components/Loader';
// Create the async route
const AsyncRoute = Loadable({
loader: () => import('./index'),
@mcallegari10
mcallegari10 / sass-setup.md
Created December 18, 2017 01:16
Ruby and SASS quick setup

Ruby

For the sole purpose to use SASS, you need to install Ruby the right way. That is with either RBENV or RVM. If you are not going to do the Ruby on Rails training, I highly encorage you to do it with RVM.

Installation

Run the following commands in your terminal:

@mcallegari10
mcallegari10 / styles.css
Created September 20, 2017 21:58
Styles overriding examples
.conversation-container > .header {
background-color: red;
}
.message > .response {
background-color: black;
color: white;
}
@mcallegari10
mcallegari10 / App.js
Created September 7, 2017 21:34
React Chat Widget 4
import React, { Component } from 'react';
import { Widget, addResponseMessage } from 'react-chat-widget';
class App extends Component {
componentDidMount() {
addResponseMessage("Welcome to this awesome chat!");
}
handleNewUserMessage = (newMessage) => {
console.log(`New message incomig! ${newMessage}`);