Skip to content

Instantly share code, notes, and snippets.

View peel's full-sized avatar

Piotr Limanowski peel

View GitHub Profile
@peel
peel / vim.rb
Created October 23, 2012 19:04 — forked from dpo/vim.rb
Homebrew formula to build vim against Homebrew Python 2.7.3 with client/server feature
# To build vim against homebrew Python 2.7.3.
# You'll also need to adjust the symbolic link of the current
# system Python framework (cf. http://goo.gl/b66fs):
#
# cd /System/Library/Frameworks/Python.framework/Versions
# sudo rm Current
# sudo ln -sf /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current Current
require 'formula'
@peel
peel / openinvim
Created February 10, 2013 12:42
Open in Vim automator script
on run {input, parameters}
if (count of input) > 0 then
tell application "System Events"
set runs to false
try
set p to application process "iTerm"
set runs to true
end try
end tell
tell application "iTerm"
object Mergesort {
def sort(items: List[Int], sorter: (Int, Int) => Boolean): List[Int] = {
if (items.length == 0) {
List[Int]();
} else if (items.length == 1) {
items;
} else {
merge(
sort(items.slice(0, items.length / 2), sorter),
public class LoanApplication {
private long applicationNo;
private long amount;
private String email;
private String contact;
private boolean approved;
public LoanApplication() {
applicationNo = LoanHandler.getNextId();
@peel
peel / mergesort.scala
Last active August 29, 2015 14:04
sorting in scala
def mergesort(toSort: List[Int]) : List[Int] = {
if(toSort.length<=1) toSort
else{
val (left, right) = split(toSort)
merge(mergesort(left), mergesort(right))
}
def split(toSplit: List[Int]): (List[Int], List[Int]) = toSplit splitAt toSplit.length/2
def merge(left: List[Int], right: List[Int]):List[Int] = {
(left, right) match {
@peel
peel / newLocationToLocation.scala
Created October 27, 2014 14:59
implicit location conversion
implicit def newLocationToLocation(l: NewLocation):Location={
val id:Int = 1 //sql"select s_id.nextval from dual".execute
new Location(id,l.name,l.serverId,s"${l.directory}/${l.regexp}",l.directory,l.quartzPattern,l.triggerBy,l.disabled,l.ftpConnectionMode,l.dataTransferMode,l.preSite,l.postSite,l.transferBy,l.wasModified,l.filterOutTransferred)
}
@peel
peel / gist:ca8c5b25efbe3052fdb5
Last active May 11, 2022 21:17
SJ4000 WIFI Protocol

#Base URL http://192.168.1.254

File Management Panel

GET / file management panel

Configuration options

all options follow the template: /?custom=1&cmd={Command}&par={Option} Command - setting/mode of the device

@peel
peel / build.sbt
Created December 12, 2014 12:33
image parser
...
scalaVersion := "2.11.4"
libraryDependencies ++= Seq(
...
"com.sksamuel.scrimage" %% "scrimage-core" % "1.4.1",
"com.sksamuel.scrimage" %% "scrimage-canvas" % "1.4.1",
"com.sksamuel.scrimage" %% "scrimage-filters" % "1.4.1"
)
@peel
peel / declutter-corporate-dev-twitter.js
Last active August 29, 2015 14:13
declutter-corporate-dev-twitter.js
javascript:$('body').bind('ajaxSuccess',declutter);void(declutter());function declutter(){var rk=['java ee', 'java ee microservices', 'maven node plugin', 'maven grunt plugin', 'xml config'];$.each($('li.stream-item'), function(){var c = $(this).html(); var p = $(this); $.each(rk, function(i, v){ if(c.toLowerCase().indexOf(v) > 0){p.remove();}});});}
<script id="jsbin-javascript">
// object - contract/guard
var str = function (s) {
if (typeof s !== "string") {
throw new TypeError("Expected a string");
} else {
return s;
}
};