Skip to content

Instantly share code, notes, and snippets.

View mikz's full-sized avatar

Michal Cichra mikz

  • Prague, Czech Republic
View GitHub Profile
Imports Calculator.CalculatorModel
Public Class Calculator
Dim WithEvents model As CalculatorModel
Private Sub MemoryController(ByVal sender As System.Windows.Forms.Button, ByVal e As System.EventArgs) Handles MemCBtn.Click, MemMBtn.Click, MemPBtn.Click, MemRBtn.Click, MemSBtn.Click
Try
Private Sub GeneratePasswords(sheetName As String, count As Integer)
For i = 1 To count
Sheets(sheetName).Cells(i, 2).Value = GeneratePassword
Next i
End Sub
Public Function GeneratePassword() As String
Dim lowercase, decimals, special As String
@mikz
mikz / Twister.rb
Created December 14, 2010 11:37
Randomly selects body parts and colors and then speaks instructions. Controller by voice. Depends on MacRuby.
#/usr/bin/env ruby
framework "AppKit"
app = NSApplication.sharedApplication
class TwisterDelegate
SIDES = %w{left right}
BODY_PARTS = %w{foot hand}
COLORS = %w{red green blue yellow}
@mikz
mikz / format.js
Created September 24, 2010 12:49
(function(){
var Format = {
defaults: {
precision: 3,
delimiter: ',',
separator: ' ',
fixed_length: false,
fixed_delimiter: " ",
precision_unit: null,
currency: "Kč"
@mikz
mikz / gist:574015
Created September 10, 2010 17:14
def quoted_date(value)
if value.acts_like?(:time) && value.respond_to?(:usec)
begin
"#{value.getutc.to_s(:db)}.#{sprintf("%06d", value.usec)} #{value.formatted_offset}"
rescue
"#{super}.#{sprintf("%06d", value.usec)}"
end
else
super
class Reservation::Group < ActiveRecord::Base
set_table_name "reservation_groups"
has_many :reservations, :foreign_key => "group_id"
has_many :reservation_views, :order => "start DESC, duration ASC", :foreign_key => "group_id", :class_name => "Reservation::View"
attr_accessor :tmpid
validates_presence_of :name
default_scope :order => "LOWER(name) ASC"
end