Skip to content

Instantly share code, notes, and snippets.

@argan
argan / 0_reuse_code.js
Created Jun 13, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View DirectMemorySize.java
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
public class DirectMemorySize extends Tool {
View DumpClassURL.java
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
public class DumpClassURL extends Tool {
public void run() {
View HelloWorld.java
public class HelloWorld {
private static int foo() {
return 42;
}
private static void bar() {
}
public static void main(String[] args) throws Exception {
foo();
View Article.scala
case class Article(...);
object Article {
import DBUtil._
def delete(id: Long): Either[String, Boolean] = {
withTransaction { implicit connection =>
SQL("DELETE FROM comments WHERE article_id = {id}").on("id" -> id).executeUpdate()
SQL("DELETE FROM appusers WHERE id = {id}").on("id" -> id).executeUpdate( )
Right(true)
View MysteryBox.java
public class MysteryBox {
private long x0, x1;
private boolean y0, y1, y2, y3;
private int z0;
private double[] a = new double[8];
}
View Unicorn.java
import java.io.OutputStream;
import java.io.PrintStream;
public class Unicorn {
private static String str1 = "UNICORN #1: PAT THIS UNICORN ONCE";
private static String str2 = "UNICORN #2: PAT THIS UNICORN ONCE";
static class Printer extends PrintStream {
private PrintStream origin;