Skip to content

Instantly share code, notes, and snippets.

@ajoberstar
ajoberstar / cleanupSublimeProjects.groovy
Created January 16, 2013 02:22
Script that will remove projects that no longer exist from Sublime Text 2 "recent projects" list.
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
def session = new File('C:/Users/<user name here>/AppData/Roaming/Sublime Text 2/Settings/Session.sublime_session')
def json = session.withReader { reader ->
new JsonSlurper().parse(reader)
}
json.workspaces.recent_workspaces.retainAll { new File(it.replaceAll(/^\/(\w+)/, '$1:')).exists() }
@ajoberstar
ajoberstar / sublime-project.gradle
Last active December 11, 2015 06:38
Gradle init script adding a task that creates a Sublime Text 2 project file.
import groovy.json.JsonBuilder
rootProject {
task sublimeProject {
group = 'IDE'
description = 'Generate a project file for Sublime Text 2.'
doLast {
def json = new JsonBuilder()
def projectPaths = allprojects.collectEntries { project ->
[(project.name):project.projectDir.canonicalPath.replaceAll($/\\/$, '/')]
@ajoberstar
ajoberstar / GradleDist.groovy
Last active December 9, 2016 03:29
Class to work around the coupling between Gradle version of build and Gradle version used as dependency for plugins.
package org.ajoberstar.gradle.hack
import org.gradle.api.Project
import org.gradle.api.file.FileTree
import org.gradle.wrapper.Download
import org.gradle.wrapper.Install
import org.gradle.wrapper.Logger
import org.gradle.wrapper.PathAssembler
import org.gradle.wrapper.WrapperConfiguration
@ajoberstar
ajoberstar / eclipse-java-google-format-nowrap.xml
Last active September 8, 2019 18:39
Modified version of Google's Java style guide with automatic line wrapping disabled
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle (nowrap)" version="13">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
@ajoberstar
ajoberstar / eclipse-java-formatter.xml
Created June 3, 2018 14:09
Eclipse Java Formatter Settings
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle (nowrap)" version="13">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>