Skip to content

Instantly share code, notes, and snippets.

View dimasusername's full-sized avatar
🏇

Dmitrii Kharlamov dimasusername

🏇
View GitHub Profile
@dimasusername
dimasusername / todo-app.tsx
Created October 2, 2025 17:16
Sonnet 4.5 One-Shot ToDo with `create to-do app in react with vite`
import { useState } from 'react';
import { Trash2, Plus, Check } from 'lucide-react';
export default function TodoApp() {
const [todos, setTodos] = useState([]);
const [input, setInput] = useState('');
const addTodo = () => {
if (input.trim()) {
setTodos([...todos, { id: Date.now(), text: input, completed: false }]);
@dimasusername
dimasusername / react_vite_to_do_app_single_file.jsx
Created October 2, 2025 17:15
GPT-5 One-Shot ToDo with `create to-do app in react with vite`
import { useEffect, useMemo, useRef, useState } from "react";
// Single-file React To‑Do app
// Features: add, edit, complete, delete, filter (All/Active/Completed),
// clear completed, reorder via drag, and localStorage persistence.
// Works out of the box in a Vite React template by replacing App.jsx.
const STORAGE_KEY = "todoapp.v1.items";
function uid() {
@dimasusername
dimasusername / pass.md
Created July 22, 2025 13:41 — forked from sgarciav/pass.md
Initialize your password store

About

Summarizing the instructions of the pass tool (as seen on its website).

Getting Started

Installation

Execute: $ sudo apt install pass

@dimasusername
dimasusername / Gemfile
Created February 19, 2020 21:23 — forked from caseywatts/Gemfile
Sinatra on Cloud9
source 'https://rubygems.org'
gem 'sinatra'
gem 'sinatra-contrib'
@dimasusername
dimasusername / resque_solo_cleanup.rb
Last active March 24, 2018 09:11
Resque Solo Cleanup
Resque.queues.each do |q|
begin
# Resque.remove_queue_with_cleanup(q)
ResqueSolo::Queue.cleanup(q)
rescue => e
puts("#{e} for queue #{q}")
end
end
Resque.reset_delayed_queue
@dimasusername
dimasusername / sticky_footer.html
Created January 4, 2018 03:43
Sticky footer with centered content Bootstrap 3
@dimasusername
dimasusername / mongoid_money_usage.rb
Created January 1, 2018 03:31 — forked from zefer/mongoid_money_usage.rb
Money represented with the Money gem, persistence using Mongoid
class Product
include Mongoid::Document
include Mongoid::Timestamps
field :description, :type => String
field :price_pence, :type => Integer, :default => 0
field :currency_iso, :type => String, :default => Money.default_currency.iso_code
validates_presence_of :description
child_coll = Mongoid.database.collection('children')
Parent.all.each do |p|
p.childs.all.each do |c|
c.attributes['parent_id'] = p.id
child_coll.insert c.attributes # save children to separate collection
end
p.childs = nil # remove embedded data
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i)
end
Resque::Failure.clear