Skip to content

Instantly share code, notes, and snippets.

View s4nchez's full-sized avatar

Ivan Sanchez s4nchez

View GitHub Profile
public static void main(String... args){
int i = 0;
for (i = 0; i < 10; i++) {
System.out.println("i=" + i);
}
System.out.println("final i=" + i);
}
@s4nchez
s4nchez / gist:1111657
Created July 28, 2011 14:41
IntelliJ IDEA Live Template for equals() and hashCode() using apache commons
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
@s4nchez
s4nchez / js_test.html
Created August 11, 2011 15:22
Basic JavaScript skills test
<html>
<head></head>
<body>
<input name="myButton" type="button" value="button 1">
<input name="myButton" type="button" value="button 2">
<input name="myButton" type="button" value="button 3">
<script type="text/javascript">
var buttons = document.getElementsByName("myButton");
@s4nchez
s4nchez / watchr.rb
Created August 25, 2011 20:09
Watchr config for jasmine-node
watch('./(.*).js') { |m| run_tests }
def run_tests
output = `jasmine-node spec/`
report output rescue nil
end
def report(output)
tests = /[0-9]+ tests?/.match(output).to_s;
failures = /[0-9]+ failures?/.match(output).to_s;
@s4nchez
s4nchez / install_rmagick.sh
Created July 25, 2012 19:41
Merge all images in directory into one
#!/bin/bash
brew install imagemagick
gem install rmagick
@s4nchez
s4nchez / gist:4713057
Last active March 7, 2022 01:22
Command line tools every developer should know

Command line tools every developer should know

Prior reading

  • The Unix philosophy, specially the "Make each program do one thing well" [1]

Basic

  • File and directory navigation/manipulation (ls, cd, mkdir, rm, rmdir, touch, cp, mv)
  • ln/unlink/readlink
@s4nchez
s4nchez / topics.md
Last active December 22, 2015 21:38
Software Craftsmanship Roundtable 11/09/2013

Lightning Talks

  • Is code like milk or wine?
  • Talk to the hand
  • Curry as dependency injection
  • Scepticism Patterns
  • Less is More
  • Everybody should be a Certification Authority

Discussion Topics

@s4nchez
s4nchez / gist:981b682a96616f7ced6c
Last active January 1, 2016 22:19
Workstation Terminal Configuration

Pre requisites

  • Mac OSX
  • Brew
  • iTerm2
  • wget
  • git

iTerm colour scheme

@s4nchez
s4nchez / BarelyMagical.kt
Created August 22, 2017 07:50
A simple wrapper around utterlyidle
import com.googlecode.utterlyidle.*
import com.googlecode.utterlyidle.servlet.ApplicationServlet
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
class Application(bindings: List<Binding>): HttpHandler {
val matcher = BindingMatcher(bindings = bindings)
override fun handle(request: Request): Response {
@s4nchez
s4nchez / gpg_signing_and_intellij_idea.md
Created March 28, 2018 21:37
GPG signing and IntelliJ IDEA

The problem

By default, IntelliJ won't support the equivalent of git commit -S ... because that command expects a terminal to input the GPG passphrase.

The solution

Create a script that will perform the GPG signing on commits without a terminal:

gpg-no-tty.sh