Skip to content

Instantly share code, notes, and snippets.

View zishe's full-sized avatar
🏠
Working from home

Alexander Kireev zishe

🏠
Working from home
  • Ko Pha Ngan, Thailand
View GitHub Profile
@zishe
zishe / Window.tsx
Created May 13, 2024 19:46 — forked from clinuxrulz/Window.tsx
SolidJS reusable draggable/resizable window example (requires bootstrap style sheet and an icon for grip drag corner "svgs/icons/resize%20grip.svg")
import { batch, Component, createEffect, createMemo, onCleanup, onMount } from 'solid-js';
import { createStore } from 'solid-js/store';
const Window: Component<{
title?: string,
width?: number,
height?: number,
initX?: number,
initY?: number,
}> = (props) => {
@zishe
zishe / README.markdown
Created July 22, 2020 08:42 — forked from alexshk/README.markdown
List of countries in YAML, CSV and TXT format
@zishe
zishe / ruby_override_new.rb
Created May 28, 2017 04:32 — forked from Integralist/ruby_override_new.rb
Ruby: override `new` constructor method using meta programming
module Bar
module ClassMethods
# `new` is a class method on the `Class` object
# It then uses `send` to access `initialize` which would otherwise be a private instance method
# So it can be overridden by extending the your class with a new `new` class method
def new(*args, &block)
super
p "new constructor defined"
end
end
@zishe
zishe / 1. results
Created August 24, 2014 07:10 — forked from headius/1. results
# interpreted AST
system ~/projects/jruby $ jruby.bash -X-C mandelbrot.rb 20
warming up
running mandelbrot(500) for 20 iterations
4.862
4.822
4.822
4.846
5.057
@zishe
zishe / Gemfile
Created November 30, 2013 08:45 — forked from pcreux/Gemfile
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
@zishe
zishe / taggable.rb
Created October 29, 2013 02:56 — forked from ayrton/taggable.rb
module Taggable
extend ActiveSupport::Concern
included do
attr_accessible :tags
after_save :set_tags
after_destroy :unset_tags
end
SourceFileInfo.find_or_create_by(hash: hash) do |sfi|
sfi.name = file_id
sfi.ext = ext
sfi.path = file_path
sfi.original_name = original_name
sfi.user = user
end
require 'spec_helper'
describe FeaturePool do
it "creates a new instance given valid attributes" do
Fabricate :feature_pool
end
it "is not valid without a name" do
Fabricate.build(:feature_pool, :name => "").should_not be_valid
end