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
environment.servlets().addFilter("cors-filter", CrossOriginFilter.class) | |
.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), 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
class X: | |
def __enter__(self): | |
print "entering" | |
def __exit__(self, exception_type, exception_val, trace): | |
print "exiting" | |
def restart(): | |
return X() |
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
module Main where | |
primes = 1:(nextPrime 2 []) | |
divisibleByAny x numbers = any (\n -> (rem x n) == 0) numbers | |
nextPrime start primesSoFar = let | |
nextP = head (dropWhile (\x -> divisibleByAny x primesSoFar) [start..]) | |
in | |
nextP:(nextPrime (nextP + 1) (nextP:primesSoFar)) |
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 http = require('http'); | |
module['exports'] = function echoHttp (hook) { | |
hook.debug("Debug messages are sent to the debug console"); | |
hook.debug(hook.params); |
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
public static class MapMatcher<K, V> extends TypeSafeMatcher<Map<K, V>> { | |
private final Map<K, V> desiredContents = new HashMap<>(); | |
@Override | |
protected boolean matchesSafely(final Map<K, V> item) { | |
for(final Map.Entry<K, V> kvEntry : this.desiredContents.entrySet()) { | |
if (!kvEntry.getValue().equals(item.get(kvEntry.getKey()))) { | |
return false; | |
} |
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
#include <stdio.h> | |
int main(int argc, char ** argv){ | |
int a,b; | |
printf("Program policzy roznice dwoch liczb,podaj pierwsza z nich \n"); | |
scanf("%d \n",&a); | |
printf("Podaj druga liczbe \n"); | |
scanf("%d \n",&b); | |
printf("roznica wynosi %d ", a-b); | |
getchar(); | |
return 0; |
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
#include <stdio.h> | |
main() { | |
int wielkosc_bufora = 100; | |
char bufor[wielkosc_bufora]; // bufor do ktorego bedziemy czytac dane | |
FILE * plik; // zmienna zawierajaca uchwyt do pliku | |
plik = fopen("plik_wejsciowy.txt", "r"); // sciezka do pliku, tryb otwarcia do odczytu | |
fgets(bufor, wielkosc_bufora - 1, plik); // wczytanie pierwszych 99 bajtow pliku do bufora (PAMIETAJ - (wielkosc bufora - 1) poniewaz musisz zostawic miejsce na \0 w stringu |
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
#include <stdio.h> | |
main() { | |
FILE * plik; // uchwyt do pliku | |
char bufor[100]; // zawartosc tego bufora zapiszemy do pliku | |
plik = fopen("plik_wyjsciowy.txt", "w"); // otwarcie pliku do odczytu | |
scanf("%99s", bufor); // wczytanie lancucha znakowego do bufora (99 poniewaz musi sie zmiescic jeszcze \0) | |
fputs(bufor, plik); // zapis do pliku |
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
# | |
# Utility functions to spawn terminals automatically | |
# @kubek2k 2012 | |
# | |
# sample usage: | |
# open_new_session_and_run_command ssh myhost tail -f /log/syslog.log | |
YAKUAKE_DBUS="qdbus org.kde.yakuake" | |
function close_session { |
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
#!/bin/bash | |
curl -u $GITHUB_USER:$GITHUB_TOKEN https://$GITHUB_HOST/api/v3/users/$GITHUB_ORG/repos?per_page=1000 | json -a 'ssh_url' |
OlderNewer