Skip to content

Instantly share code, notes, and snippets.

@wbars
wbars / Animal.java
Last active August 29, 2015 14:19
Соблюдение контракта
package com.example.helloworld;
/**
* Created by wannabe on 12.04.15.
*/
interface Animal
{
int getLegsCount();
animal move();
}
@wbars
wbars / main.java
Created April 13, 2015 11:31
java-example
public class Main
{
public void main()
{
Test test = new Test();
Test.Inner inner = test.new Inner();
inner.testMethod();
}
}
@wbars
wbars / DataStructure.java
Created April 14, 2015 11:07
java-obfuscation
public class DataStructure {
// Create an array
private final static int SIZE = 15;
private int[] arrayOfInts = new int[SIZE];
public DataStructure() {
// fill the array with ascending integer values
for (int i = 0; i < SIZE; i++) {
arrayOfInts[i] = i;
@wbars
wbars / BasicEmployee.java
Last active August 29, 2015 14:19
Company
package com.example.helloworld;
import java.util.Date;
/**
* Created by wannabe on 18.04.15.
*/
public abstract class BasicEmployee {
protected int id;
protected String name;
def fizzbuzz(range, triggers)
range.map do |i|
parts = triggers.select{ |(_, predicate)| predicate.call(i) }
parts.size > 0 ? parts.map(&:first).join : i
end
end
puts fizzbuzz(1..100, [
['Fizz', ->(i){ i % 3 == 0 }],
['Buzz', ->(i){ i % 5 == 0 }],
@wbars
wbars / default
Created May 5, 2015 01:51
Nginx config for symfony2
server {
listen 80;
server_name localhost;
root %PROJECT_HOME_DIR%/web;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
package com.company;
import java.util.ArrayList;
import java.util.Stack;
/**
* Created by wannabe on 08.05.15.
*/
public class ThreadHandle {
public static final int threadsCount = 10;
SELECT
main_cat.id,
main_cat.name,
last_thread.thread_id,
last_thread.name,
last_thread.transliteratename,
last_thread.posted_at,
last_thread.user_id,
last_thread.username,
counts.thread_count
public class Utils {
public interface SumOfDigits {
Integer run(String s);
}
public static String orderWeight(String strng) {
SumOfDigits sumOfDigits = s ->
Arrays.asList(s.split(""))
.stream()
.mapToInt(Integer::parseInt)
class Ancestor
{
private static test()
{
echo "Ancestor::test";
}
public static proxy()
{
self::test();