Skip to content

Instantly share code, notes, and snippets.

View vasiliy-pdk's full-sized avatar
🇺🇦

Vasyl Pedak vasiliy-pdk

🇺🇦
View GitHub Profile
@vasiliy-pdk
vasiliy-pdk / shortenedExample.jsx
Created March 2, 2024 17:44
Separate presentation from domain logic in SolidJS
// Shortened example
// in Exercise/index.jsx
import withState from 'components/withState';
import { createExercise } from './createExercise';
import { Exercise as ExerciseUi } from './Exercise';
export const Exercise = withState(ExerciseUi, (props) => createExercise(props.skill));
// in withState.jsx
import { mergeProps } from "solid-js";
@vasiliy-pdk
vasiliy-pdk / whats_wrong_with_visibility.rb
Created January 17, 2020 14:36
An exercise for understanding methods visibility in Ruby, created for one of Tech Lunches
class A
def access_bar
puts "#{self} accessing bar. Bar is #{bar}"
end
def access_foo(fooer)
print "#{self} sends `foo` message which is "
puts fooer.foo
end
@vasiliy-pdk
vasiliy-pdk / FpsCounter.js
Created November 6, 2015 21:53
The simplest FPS meter for playcanvas
pc.script.create('fpsCounter', function (app) {
// Creates a new FpsCounter instance
var FpsCounter = function (entity) {
this.entity = entity; // The scene object
this.fpsCount = 0;
this.counterEl = null;
this.insertBeforeElId = "application-canvas";
};