Skip to content

Instantly share code, notes, and snippets.

@dkandalov
dkandalov / gist:3857613
Created October 9, 2012 09:24
Intellij eval process files from your change list
import com.intellij.notification.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.vcs.changes.*
import javax.swing.SwingUtilities
static show(String htmlBody, String title = "", NotificationType notificationType = NotificationType.INFORMATION) {
SwingUtilities.invokeLater({
def notification = new Notification("", title, htmlBody, notificationType)
ApplicationManager.application.messageBus.syncPublisher(Notifications.TOPIC).notify(notification)
@dkandalov
dkandalov / plugin.groovy
Created October 12, 2012 15:27
"grep" action for intellij-eval
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.notification.Notifications
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.KeyboardShortcut
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.actionSystem.EditorAction
import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler
@dkandalov
dkandalov / gist:4080326
Created November 15, 2012 18:33
"open files from current change list" action for intellij-eval
import com.intellij.notification.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.vcs.changes.Change
import com.intellij.openapi.vcs.changes.ChangeListManager
import javax.swing.SwingUtilities
static show(String htmlBody, String title = "", NotificationType notificationType = NotificationType.INFORMATION) {
SwingUtilities.invokeLater({
@dkandalov
dkandalov / compile-and-run.sh
Created December 26, 2012 16:27
intellij-eval plugin to compile and run single ".c" file
#/bin/sh
FILE_NAME=$1
FILE_PATH=$2
gcc -o $FILE_NAME $FILE_PATH/$FILE_NAME.c && ./$FILE_NAME
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@dkandalov
dkandalov / gist:4761632
Created February 12, 2013 11:13
AnalysisUtil
class AnalysisUtil {
static def aggregateByDuration = { events -> events.sum(0) { it.duration } }
static def aggregateByQueryDuration = { events -> events.sum(0) { it.queryDuration } }
static def aggregateByAmount = { events -> events.size() }
static def histogramOf(Closure criteria, amountOfIntervals, List lines) {
double maxValue = criteria(lines.max(criteria))
double minValue = criteria(lines.min(criteria))
double intervalSize = (maxValue - minValue) / amountOfIntervals
@dkandalov
dkandalov / 12 years of "TODO"
Last active December 13, 2015 23:59
Beautiful code best practice enterprise patterns
/**
* Insert the method's description here.
* Creation date: (4/16/01 3:47:01 PM)
* @param newHierarchy com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Hierarchy
*/
public void setHierarchy(com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Hierarchy newHierarchy) {
@dkandalov
dkandalov / gist:5066611
Last active December 14, 2015 09:39
simple d3 script for displaying timebased events from csv
var csv = ""; // paste csv into this string
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseFormat = d3.time.format("%H:%M:%S");
var displayFormat = d3.time.format("%H:%M");
var x = d3.time.scale().range([0, width]);
@3noch
3noch / Either.h
Last active July 9, 2020 15:27
An implementation of Haskell's "Either" type C++
#pragma once
#include <boost/optional.hpp>
/**
* Wraps any value with a context of Left for the Either class.
*
* By convention, Left represents some sort of less-desired condition.
*/
@cholick
cholick / build.gradle
Last active October 24, 2018 21:08
Using Gradle & jarjar to repackage and embed incompatible transitive dependencies
apply plugin: 'groovy'
repositories {
mavenCentral()
}
configurations {
patch
[compile, testCompile]*.exclude module: 'jersey-server'
}