Skip to content

Instantly share code, notes, and snippets.

View richashworth's full-sized avatar

Richard Ashworth richashworth

View GitHub Profile
nmap <C-m> ggVG<C-c><C-c>
@etorreborre
etorreborre / gist:1387113
Created November 22, 2011 21:50
An example of a non-terminating compilation with javac
/** from http://www.reddit.com/r/programming/comments/mlbna/scala_feels_like_ejb_2/c31z0co */
interface Pong<T> {}
class Ping<T> implements Pong<Pong<? super Ping<Ping<T>>>> {
static void Ping() {
Pong<? super Ping<Long>> Ping = new Ping<Long>();
}
}
> javac Ping.java
@richashworth
richashworth / DataProvider.java
Last active October 1, 2015 19:18
Used as dependency in PowerMock Example
package com.richashworth.powermockexample;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import static com.google.common.io.Files.readLines;
public final class DataProvider {
@richashworth
richashworth / ResultsWriter.java
Last active June 28, 2020 15:07
Used as Class Under Test in PowerMock Example
package com.richashworth.powermockexample;
import java.util.List;
public class ResultsWriter {
public String getDataAsString(){
StringBuilder builder = new StringBuilder();
List<String> dataList = DataProvider.getData();
for(String str: dataList){
@richashworth
richashworth / ResultsWriterTest.java
Last active March 1, 2019 18:54
Unit Test used in PowerMock Example
package com.richashworth.powermockexample;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 23, 2024 18:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@derekwyatt
derekwyatt / ACoupleOfUseExamples.scala
Created July 18, 2012 20:51
Scalatest Fixtures and Akka - parallel fixture isolation - sequential fixture isolation - and no fixture
// Examples showing how to use the specification helpers
//
import akka.actor.ActorSystem
import akka.testkit.{TestKit, ImplicitSender}
import org.scalatest.{WordSpec, BeforeAndAfterAll}
import org.scalatest.matchers.MustMatchers
// Sequentially runs the tests, isolating the Fixture in each test. The Fixture carries the TestKit
// so each test gets its own ActorSystem
class MyAkkaTestSpec extends SequentialAkkaSpecWithIsolatedFixture {
@loicdescotte
loicdescotte / Forcomptran.md
Last active May 27, 2023 06:27
Scala for comprehension translation helper

Scala for comprehension translation helper

"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.

yield keyword is used to aggregate values in the resulting structure.

This composition can be used on any type implementing this methods, like List, Option, Future...

@richashworth
richashworth / gist:8138799
Created December 26, 2013 21:17
Fix for Jetpack RSS Widget
if ( 'text-image' == $format )
$link_item .= '<p>&nbsp;<a href="' . get_bloginfo($rss_type) . '" title="' . esc_attr( $subscribe_to ) . '"><br/>' . esc_html__('RSS - ' . $type_text, 'jetpack'). '</a></p>';
@EinfachToll
EinfachToll / vwtags.py
Created February 18, 2014 14:04
Vimwiki Tagbar integration
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Put this file anywhere and add the following to your .vimrc.
# The value of ctagsargs must be one of 'default', 'markdown' or 'media'.
#
# let g:tagbar_type_vimwiki = {
# \ 'ctagstype':'vimwiki'
# \ , 'kinds':['h:header']
# \ , 'sro':'&&&'