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
function isEven(number) { | |
return !(number & 1); | |
} | |
function isOdd(number) { | |
return !!(number & 1); | |
} | |
isOdd(5); // true |
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
var text = ""; | |
var alphabet = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z".split(","); | |
var wordCount = 256; | |
for(var i=0; i<wordCount; i++) { | |
var rand = null; | |
for (var x=0; x<7; x++) { | |
rand = Math.floor(Math.random() * alphabet.length); | |
text += alphabet[rand]; | |
} | |
if (i<wordCount-1) |
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
// remove utf-8 BOM from ressource "res" | |
// res.charCodeAt(0) === 0xFEFF | res.charCodeAt(0) === 65279 | |
if (res.charCodeAt(0) === 0xFEFF) { | |
res = res.substr(1); | |
} |
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
<?php | |
$arr1 = array( | |
"a" => ["x", "d" => "override me..", "d2" => ["q"], "v" => "NOT-IN-B"], | |
"b" => ["d" => 155, "fff" => ["aa"=>551]], | |
5, 8, 9 | |
); | |
$arr2 = array( | |
"a" => ["v", "d" => "overrided!", "qq" => "ONLY-IN-B"], |
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
<?php | |
/* | |
> composer install | |
# encript: | |
php _encript-decript-from-console.php enc "password" file.pdf | |
=> result = timestamp-file.pdf.enc | |
php _encript-decript-from-console.php enc "password" image.jpg | |
=> result = timestamp-mage.jpg.enc | |
php _encript-decript-from-console.php enc "password" folderA |
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
var jsonDummy = { | |
key: 'val', | |
underobj: { | |
ewssswww: undefined, | |
asdas: 45105, | |
ssswww: undefined, | |
errwew: undefined, | |
ssswww: 0, | |
sdfsd: 'dfsdf', | |
uuunt: { |
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
@java.lang.FunctionalInterface | |
interface Math | |
{ | |
public int calc(int a, int b); | |
} | |
public class LambdaExample | |
{ | |
public static void main(String[] args) { | |
// define your 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
import anwendung.Bank; | |
import anwendung.Gescheaftskonto; | |
import anwendung.PrivatKonto; | |
public class App | |
{ | |
public static void main(String[] args) { | |
// you can implement DI with setter injection or with constructor injection. | |
// below you see an example with constructor injection |
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
import com.google.common.eventbus.EventBus; | |
public class GoolgeGuavaEventBus | |
{ | |
public static void main(String[] args) { | |
EventBus eventBus = new EventBus(); | |
//register the receiver | |
Listener1 l1 = new Listener1(); | |
Listener2 l2 = new Listener2(); | |
eventBus.register(l1); |
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
import com.google.inject.AbstractModule; | |
import com.google.inject.Guice; | |
import com.google.inject.Inject; | |
import com.google.inject.Injector; | |
import javax.inject.Singleton; | |
public class MainApp { | |
public static void main(String[] args) { | |
Injector injector = Guice.createInjector(new AppInjector()); |
OlderNewer