Skip to content

Instantly share code, notes, and snippets.

@yegeniy
yegeniy / pom.xml
Last active April 27, 2017 15:00
Maven Sandbox. Note that `MainClass.java` should be put under `src/main/java`
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.mlbam.bdt</groupId>
<artifactId>java-sandbox</artifactId>
<version>0.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Java Sandbox</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@yegeniy
yegeniy / MainClass.java
Last active April 27, 2017 14:14
Sandbox for standard java library
import java.util.*;
public class MainClass {
public static void main(String[] args) {
System.out.println(Arrays.deepToString(args));
}
}
- match: \b(catch)\b
scope: keyword.control.catch-exception.java
push:
- meta_scope: meta.catch.java
- match: (?=\))
pop: true
- include: catch-clause
# https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.20
@yegeniy
yegeniy / csv2json.py
Created January 18, 2013 16:56
csv2json Copied from somewhere on the internet. Usage to get the json into an expanded format and into your clipboard: `python csv2json.py myfile.csv | python -m json.tool | pbcopy`
import sys, csv, json
if len(sys.argv) == 1:
print "1 argument for filename required"
sys.exit()
gdoc = csv.reader(open(sys.argv[1]))
# Get the 1st line, assuming it contains the column titles
fieldnames = gdoc.next()
@yegeniy
yegeniy / gist:3885248
Created October 13, 2012 16:30
Why does slf4j overload its Logger.debug methods instead of using a single method with varargs?

slf4j's Logger.debug is a perfect example of item 42 in Effective Java 2nd Edition (on varargs), but I have a question.

I believe that they have found that the vast majority of use cases of debug have 2 or less arguments and that by over loading the methods with 0,1,2 arguments, the implementation is able to avoid allocating an array?

  /**
   * Log a message at the DEBUG level.
   *
   * @param msg the message string to be logged
   */
@yegeniy
yegeniy / ubuntuDevSetupPhpMongoMysql.md
Created April 12, 2012 04:00
Dev environment setup on Ubuntu for PHP, Mongo, MySQL

Install php

sudo apt-get install -y php5-common libapache2-mod-php5 php5-cli curl libcurl3 libcurl3-dev php5-curl php5-mcrypt php5-ldap php5-gd php5-mysql phpunit php-pear

sudo pear upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear install --alldeps phpunit/PHPUnit
@yegeniy
yegeniy / Git.md
Last active February 9, 2017 10:05
git: commands I commonly use, relevant ramblings, and configuration.

Commands I Commonly Use

  1. Clone an existing repository:

    git clone <repo>

    (e.g. https://gist.github.com/1125520.git).

  2. [Checkout and pull an existing branch][gcp]: