Skip to content

Instantly share code, notes, and snippets.

View pusewicz's full-sized avatar

Piotr Usewicz pusewicz

View GitHub Profile
class Cell
@@cellid = -1
# Renaming the attribute cellid to eg. id makes it work?!
attr_reader :cellid
def initialize
@cellid = (@@cellid += 1)
end
@pusewicz
pusewicz / App.vue.diff
Last active September 12, 2022 14:10
Bonus point: Dynamic update
addTodo(e) {
const value = e.target.value.trim()
if (!value) {
return
}
const todo = {
id: Date.now(),
title: value,
completed: false
}
@pusewicz
pusewicz / App.vue.diff
Last active September 12, 2022 14:09
Step 3: Adding the timer element on screen
<div class="view">
<input class="toggle" type="checkbox" v-model="todo.completed">
<label @dblclick="editTodo(todo)">
{{ todo.title }}
+ <div class="harvest-timer" :id="todo.id"
+ :data-item="`${JSON.stringify({ id: todo.id, name: todo.title })}`"
+ :data-group="`${JSON.stringify({ id: 1, name: 'TodoMVC' })}`"
+ >
+ </div>
</label>
@pusewicz
pusewicz / index.html.diff
Created September 12, 2022 12:53
Step 2: Configuring the Platform bundle
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>todos</title>
+ <script>
+ window._harvestPlatformConfig = {
+ "applicationName": "TodoMVC",
@pusewicz
pusewicz / index.html.diff
Last active September 12, 2022 12:54
Step 1: Adding the Platform bundle
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>todos</title>
+ <script async src="https://platform.harvestapp.com/assets/platform.js"></script>
</head>
<body>
vim9script
g:test#strategy = "vimterminal"
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
def HdtTransform(cmd: string): string
var cmd_string = cmd
if !empty(glob(".docker/tilt/Dockerfile"))
* INFO: The .to_s function for type [(class Label)] probably doesn't look too helpful. Trying calling the .help function. #<Label:0x7fc8c0034dd0>
Exception: ERROR:
Failed to convert #<Label:0x7fc8c0034dd0> for rendering (label).
Type Information: (class Label)
ERROR:
Unhandled method_missing with name :size_enum, args [] was invoked on class (class Label).
self#inspect:
@pusewicz
pusewicz / mov2gif.rb
Last active December 29, 2015 01:09
Convert you QuickTime recorded screencast in the MOV and turn it into an animated GIF
#!/usr/bin/env ruby
=begin
DEPENDENCIES:
$ brew install ffmpeg
$ brew install imagemagick
=end
require 'optparse'
require 'fileutils'