This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The First Class | |
* | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## The Factory's base class ######### | |
class AbstractFactory(object): | |
def create_product(self, **args): | |
raise NotImplementedError("Requires derived factory class for implementation.") | |
######### The class of the object that needs creating ########### | |
class Product(object): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### The product to contruct #### | |
class Product(object): | |
def __init__(self, extra): | |
self.extra = extra | |
def do_somthing(self): | |
print "Doing Something{0}!".format(self.extra) | |
#### The Builder for a type of product #### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeClass { | |
public int someMethod(int[] data) { | |
//do some things | |
} | |
public int someMethod(Integer[] data) { | |
// this bit convert an Integer array into an int array. | |
int[] newData = int[data.length]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg -l linux-{image,headers}-* | awk '/^ii/{print $2}' | egrep '[0-9]+\.[0-9]+\.[0-9]+' | grep -v $(uname -r) | xargs sudo apt-get -y purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils; | |
import java.util.AbstractList; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.List; | |
// This can be replaced with any other Function / Function2 interface | |
import play.libs.F.Function; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
environment: | |
JAVA_TOOL_OPTIONS: '-Dfile.encoding=UTF8 -Duser.timezone=UTC' | |
_JAVA_OPTIONS: '-Xms512m -Xmx1024m -Xss2m' | |
java: | |
version: oraclejdk8 | |
python: | |
version: 2.7.6 | |
services: | |
- docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html"> | |
<dom-module id="my-component"> | |
<template> | |
<content></content> | |
</template> | |
<style> | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<int> weekendDays = Array.asList(1,7); | |
List<Thing> productiveThings = Array.asList(study, laundry, foodShopping, gym); | |
List<Thing> thingsDone = days.stream() | |
// Split infinite stream of days into those that are wednesdays and those that are not | |
.collect(Collectors.partitionBy(day -> weekendDays.contains(day.get(Calendar.DAY_OF_WEEK)))) | |
.entrySet().stream().map(entry -> | |
// if day is not weekend and william isn't "busy" | |
return (!entry.getKey() && isQuoteBusyEndQuote(william)) | |
? beProductive(william, productiveThings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set/p host=host Address: | |
set logfile=Log_%host%.log | |
echo Target Host = %host% >%logfile% | |
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping) | |
:Ping | |
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do ( | |
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile% |
OlderNewer