Skip to content

Instantly share code, notes, and snippets.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@dimhold
dimhold / gist:5759950
Created June 11, 2013 19:41
Unit tests just for understand: What is a true way of unit testing
package how.to.use.mockito;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
@dimhold
dimhold / gist:5759968
Created June 11, 2013 19:44
Util class for unit tests (gist:5759950) just for understand: What is a true way of unit testing
package how.to.use.mockito;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
public class Util {
@dimhold
dimhold / gist:5759988
Created June 11, 2013 19:47
Class with EJB2 for understand: What is a true way of unit testing
package how.to.use.mockito;
import java.math.BigDecimal;
import javax.naming.NamingException;
public class EJBExample {
private static LogCategory log = new LogCategory("EJBExample", "how.to.use.mockito.EJBExample");
@dimhold
dimhold / github-stars-link.user.js
Last active August 29, 2015 14:05
Add stars link to github head (UserScript)
@dimhold
dimhold / youtube-subscriptions-refresh.user.js
Last active August 29, 2015 14:05
Make My Subscriptions tab clickable for refresh
// ==UserScript==
// @name youtube-subscriptions-refresh.user.js
// @namespace https://www.youtube.com/feed/subscriptions
// @description Make My Subscriptions tab clickable for refresh
// @include https://www.youtube.com/feed/subscriptions
// @version 1.0.0
// @grant none
// ==/UserScript==
var tab = document.getElementsByClassName("epic-nav-item-heading")[0];
tab.addEventListener("click", function () {
@dimhold
dimhold / xorg.conf
Created September 9, 2014 19:45
Xorg config section for use capslock button to change keyboard layouts.
#/etc/X11/xorg.conf.d/xorg.conf
#Use capslock button to change keyboard layouts.
Section "InputClass"
Identifier "keyboard-all"
Driver "evdev"
Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:caps_toggle,grp_led:scroll"
MatchIsKeyboard "on"
EndSection
@dimhold
dimhold / .gitconfig
Created September 10, 2014 19:54
Git config example
[user]
name = user
email = user@gmail.com
[alias]
co = checkout
s = status
b = branch
c = commit -a -m
l = log --stat
g = log --graph
@dimhold
dimhold / 40_custom
Created September 11, 2014 07:44
Grub windows menu
#/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows 7" {
insmod part_msdos
insmod ntfs
@dimhold
dimhold / github-network.user.js
Last active November 26, 2015 11:11
Add network menu item to the main page of repository
// ==UserScript==
// @name github-network.user.js
// @namespace https://github.com/
// @description Add network menu item to the main page of repository
// @include https://github.com/*
// @version 2.0.1
// @grant none
// ==/UserScript==
var repo = window.location.pathname;
if (repo) {