Skip to content

Instantly share code, notes, and snippets.

View gAmUssA's full-sized avatar
so hard

Viktor Gamov gAmUssA

so hard
View GitHub Profile
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.plugins.BasePlugin
/**
* apply this plugin after doing all dependency and repo stuff. It will create two idea 'libraries' per subproject
* and add them to your .iml files
*
* Forked from https://gist.github.com/360092
*
@alblue
alblue / .gitignore
Created February 12, 2012 10:29
RSS Importer for Jekyll
jekyll
@gAmUssA
gAmUssA / gist:1874976
Created February 21, 2012 07:52
Install new version of groovy
if(args.size()!=1){
println "start with sudo groovy install <version-number>"
System.exit 1
}
final version = args[0]
final installDir = "/usr/lib/"
final base = "http://dist.groovy.codehaus.org/distributions/"
final urls = [
@mojavelinux
mojavelinux / AsciiDoc.java
Created March 3, 2012 00:10
Execute AsciiDoc from Java using the Jython Interpreter
import java.io.*;
import javax.script.*;
import org.python.core.PySystemState;
import org.python.core.PyString;
import org.python.util.PythonInterpreter;
/**
* This class executes the AsciiDoc python scripts (asciidoc.py and a2x.py) from
* Java using the Jython interpreter.
*
@padcom
padcom / pom.xml
Last active October 2, 2015 14:28
Adding groovy-eclipse to Maven project
<...>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.6</version>
</dependency>
</dependencies>
<build>
@pmuellr
pmuellr / beeper.js
Created April 26, 2012 15:28
beep() and boop() with HTML5 Audio
//-----------------------------------------------------------------------------
// The MIT License
//
// Copyright (c) 2009 Patrick Mueller
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
@kconragan
kconragan / keyrepeat.shell
Last active January 15, 2025 23:02
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@pledbrook
pledbrook / BootStrap.groovy
Created May 10, 2012 12:52
Embed Vert.x in Grails
import org.vertx.groovy.core.Vertx
class BootStrap {
def init = { servletContext ->
def vertx = Vertx.newVertx()
def httpServer = vertx.createHttpServer()
vertx.createSockJSServer(httpServer).installApp(prefix: '/events') { sock ->
sock.dataHandler { buff ->
sock << buff
@valadan
valadan / latency.markdown
Created September 14, 2012 11:41 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@timyates
timyates / guava.groovy
Created September 28, 2012 12:48
Use Guava to convert string formats
@Grab( 'com.google.guava:guava:13.0.1' )
import static com.google.common.base.CaseFormat.*
String.metaClass.caseFormat = { from, to ->
from.to( to, delegate )
}
assert 'varName'.caseFormat( LOWER_CAMEL, UPPER_UNDERSCORE ) == 'VAR_NAME'
assert 'var-name'.caseFormat( LOWER_HYPHEN, UPPER_CAMEL ) == 'VarName'
assert 'var_name'.caseFormat( LOWER_UNDERSCORE, LOWER_CAMEL ) == 'varName'