Skip to content

Instantly share code, notes, and snippets.

View HiroNakamura's full-sized avatar
🏠
Working from home

Developer of interesting things HiroNakamura

🏠
Working from home
View GitHub Profile
@mariogleichmann
mariogleichmann / 'Elvis' Operator with Scala Dynamic Trait
Created January 17, 2011 22:31
'Elvis' Operator with Scala Dynamic Trait
object DynamicElvis {
class DynamicImpl( x: AnyRef ) extends Dynamic {
def _select_(name: String): DynamicElvis = {
val mName = name.substring(0, name.length - 1 )
val mVal = x.getClass.getMethod(mName).invoke( x )
new DynamicElvis( if( mVal != null ) Some( mVal ) else None )
}
@pratul
pratul / kabala-calc.py
Created January 18, 2011 14:58
A numerological calculator based on the Kabbalah alphabet. (from Linda Goodman's "Star Signs")
#!/usr/bin/python
# authored by Pratul Kalia in January 2011.
# Released into the public domain.
import sys
# Chaldean-Hebrew Kabala Numberical Alphabet.
# Taken from the book "Star Signs" by Linda Goodman.
kabala = {'a': 1, 'b': 2, 'c': 3, 'd': 4,
'e': 5, 'f': 8, 'g': 3, 'h': 5,
/*
* Added additional null checks when closing the ResultSet and Statements.
*
* Thanks to pihug12 and Grzegorz Oledzki at stackoverflow.com
* http://stackoverflow.com/questions/5332149/jdbc-scriptrunner-java-lang-nullpointerexception?tab=active#tab-top
*/
/*
* Modified: Use logWriter in print(Object), JavaDoc comments, correct Typo.
*/
/*
@jeantil
jeantil / Mastermind.java
Created February 24, 2011 18:01
softeam dojo 6
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class Mastermind {
public int[] solve(String[] guess, String[] secret) {
int bonBienplace = 0;
int bonMalplace = 0;
Set<String> setSecret = new HashSet<String>(Arrays.asList(secret));
@passingloop
passingloop / factorial.pl
Created September 16, 2011 04:55
7l7w-prolog-day2
% -*- mode: prolog; -*-
fact(1, 0).
fact(F, N) :-
N > 0,
N1 is N - 1,
fact(F1, N1),
F is F1 * N.
@MilkZoft
MilkZoft / hello.cob
Created January 23, 2012 02:54
codejobs - Hello World - Cobol
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
@CarlEkerot
CarlEkerot / FileClient.java
Created May 14, 2012 10:43
Simple java file transfer
package client;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.Socket;
public class FileClient {
private Socket s;
@maravilloso
maravilloso / Columnas y su tipo.sql
Last active July 22, 2019 03:33
Obtener nombre y código de tipo de todas las columnas de la base de datos (obviando las de sistema)
SELECT
CAST(t.tabname AS VARCHAR(15)) AS tabla,
CAST(colname AS VARCHAR(15)) AS campo,
CASE
WHEN coltype >= 256 THEN cast(coltype-256 AS VARCHAR(4))
ELSE cast(coltype AS VARCHAR(4))
END AS tipo,
collength AS lon
FROM syscolumns c, systables t
WHERE c.tabid=t.tabid AND t.tabname[1,2]='fa'
:- module(booleans, [and/2, or/2]).
:- op(1000, xfy, and).
:- op(1000, xfy, or).
and(P, Q) :- P , Q.
or(P, Q) :- P ; Q.