Skip to content

Instantly share code, notes, and snippets.

@tomasv
tomasv / gist:912242
Created April 10, 2011 10:50
xmonad config with a hack for floating windows
import XMonad
import Data.Monoid
import System.Exit
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
module Main where
omitElementAt :: Int -> [a] -> [a]
omitElementAt i list = let (left, right) = splitAt i list in left ++ (tail right)
jacobiProductSum :: Int -> [Double] -> [Double] -> Double
jacobiProductSum i a x = sum [ aj * xj | (aj, xj) <- aFiltered `zip` xFiltered ]
where
aFiltered = omitElementAt i a
xFiltered = omitElementAt i x
module Main where
import Control.Monad.Writer
import Control.Monad.Reader
rwt :: A Int
rwt = ask >>= \x -> tell ("Got " ++ show x) >> return (x * 2)
type A = ReaderT Int (WriterT String Maybe)
require 'rubygems'
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.gmail.com",
:port => 587,
:domain => 'varneckas.lt',
:user_name => '[email protected]',
:password => '',
:authentication => 'plain',
require 'rubygems'
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.gmail.com",
:port => 587,
:domain => 'varneckas.lt',
:user_name => '[email protected]',
:password => '',
:authentication => 'plain',
module Gauss where
import Datatypes
import Extra
-- 3 point Gauss coeficients and nodes
c1 = 0.5555556
c2 = 0.8888889
c3 = 0.5555556
module NotMonkeyPatchable
def method_added(name)
@methods ||= {}
if @methods[name] and not @unpatching
@unpatching = true
method = @methods[name]
define_method(name) { |*args, &block|
method.bind(self).call(*args, &block)
}
@tomasv
tomasv / rspec configuration
Created March 6, 2013 00:29
Spring + Rubymine
In shell:
export RUBYLIB=/path/to/RubyMine/rb/testing/patch/common:/path/to/RubyMine/rb/testing/patch/bdd
spring rspec spec/ # to launch spring server
In Rubymine:
Uncheck bundler
Select custom runner script as spring_rspec.rb
add same variable to environment variables:
RUBYLIB=/path/to/RubyMine/rb/testing/patch/common:/path/to/RubyMine/rb/testing/patch/bdd
@tomasv
tomasv / velocity.patch
Created August 1, 2013 21:35
Add a very custom velocity counter to sprints in redmine backlogs plugin master backlog page.
diff --git a/app/models/rb_sprint.rb b/app/models/rb_sprint.rb
index 3bed08b..4ba4961 100644
--- a/app/models/rb_sprint.rb
+++ b/app/models/rb_sprint.rb
@@ -69,6 +69,24 @@ class RbSprint < Version
return stories.inject(0){|sum, story| sum + story.story_points.to_i}
end
+ def velocity
+ return unless project.present?
launch_super_query('foo', <<-SQL, <<-TEXT)
drop table user;
SQL
I'm so sorry.
TEXT