Skip to content

Instantly share code, notes, and snippets.

View sarnobat's full-sized avatar

sarnobat

View GitHub Profile
@pascalalich
pascalalich / eclipse-templates.xml
Created February 18, 2015 06:59
Eclipse Templates for Java logging, hashCode, equals, and toString with SLF4J and Guava
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java" deleted="false" description="equals (Guava)" enabled="true" name="equals">${:import(com.google.common.base.Objects)}&#13;
@Override&#13;
public boolean equals(final Object obj) {&#13;
if (this == obj) {&#13;
return true;&#13;
}&#13;
if (obj == null) {&#13;
return false;&#13;
}&#13;
if (getClass() != obj.getClass()) {&#13;
@rmorenobello
rmorenobello / setSystemPropertyFromCLI.groovy
Last active November 2, 2020 04:46
How to set and retrieve JVM system variables when running java/groovy from CLI
// http://stackoverflow.com/questions/8098564/is-it-possible-to-specify-java-system-properties-when-running-groovy-from-comman
/*
System properties are set on the java command line using the
java -Dpropertyname=value
syntax.
They can also be added at runtime using
System.setProperty(name, value)
or via the various
System.getProperties().load()
methods.
tell application "System Events"
--set visible of every process whose visible is true and name is not in {"Finder", name of current application} to false
set visible of every process whose visible is true and name is not "Finder" and frontmost is false to false
end tell
DSLContext database = Mockito.mock(DSLContext.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(database.select(ACTIVITY_TYPE.ID)
.from(ACTIVITY_TYPE)
.where(ACTIVITY_TYPE.SINGLE_PERSON_USABLE.isTrue())
.fetch(ACTIVITY_TYPE.ID))
.thenReturn(ImmutableList.of(singleActivityTypeId));
Mockito.when(database.select(ACTIVITY_TYPE.ID)
.from(ACTIVITY_TYPE)
@venkatperi
venkatperi / gist:9664988
Created March 20, 2014 14:31
Walk up project tree to resolve project (ext) properties in Gradle
//root build.gradle
ext {
javaVersion = JavaVersion.VERSION_1_7
}
Project.metaClass.prop { name ->
delegate.with {
ext.properties.containsKey( name ) ?
ext.properties[ name ] : parent?.prop( name )
}
@inooid
inooid / .bash_profile
Created March 16, 2015 09:34
Google command to search on Google from the command line (Mac OS X)
# Command to open the webbrowser and immediately start searching
# for the right keyword.
#
# Usage:
# $ google test query
# $ => Opens the browser on http://www.google.com/search?q=test+query
#
google()
{
@ldong
ldong / DiffMerge_Change_font.md
Created September 30, 2015 21:31
Change Git: Change DiffMerge Font-Size on Mac OSX

Git: Change DiffMerge Font-Size on Mac OSX

open -e ~/Library/Preferences/SourceGear\ DiffMerge\ Preferences

Append this to it

[File]
Font=22:76:consolas
@yamalight
yamalight / README.md
Last active January 13, 2023 11:18
Feedly Colorful Listview
@rosswd
rosswd / cs.md
Last active April 13, 2023 17:16
The stack, heap, registers and instructions

Stack, Heap, Registers and Instructions

  1. Stack (push, pop, stack pointer, stack frame pointer)
  2. Heap (malloc, calloc, global, static)
  3. Registers (addresses, values)
  4. Instructions (mov, add, jmp, jne)

The Stack (LIFO)

  • push adds an element to the top of the stack
  • pop removes the top element from the stack
@p1nox
p1nox / using_meld_on_mac.md
Last active June 13, 2023 16:24
Using meld on Mac

Using Meld merging tool on Mac

There are two ways of installing meld on osx (May 2023), using brew and .dmg package (from @yousseb). Since I found https://yousseb.github.io/meld/, I've installed it with .dmg package, but having macOS Ventura Version 13.4 (22F66) in place, it's not even starting for me. So I tried brew installation, and the application is working as expected, including symlink to start it from the terminal.

brew install --cask meld

# set meld as your default git mergetool