This file contains hidden or 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
#!/usr/bin/env python | |
import unicodedata | |
from numbers import Number | |
class Shaker: | |
def __init__(self, shakerCapacity = 1000000): | |
# Zakladamy, ze pojemnosc shakera jest nieograniczona ;-) |
This file contains hidden or 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
$ -> | |
retrieveStoredFormFields = -> | |
# przejezdzam po wszystkich elementach formularza | |
# przeznaczonych do zapamietania | |
$('form .storeMe').each -> | |
# @ jest aliasem this | |
fieldValue = localStorage.getItem $(@).attr('id') | |
# jesli jest cos w localStorage to przypisuje elementowi formularza | |
if fieldValue then $(@).val fieldValue | |
This file contains hidden or 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 | |
// See the corresponding blog entries (in Polish): | |
// http://spiechu.pl/2012/05/16/tworzenie-pakietow-icmp-w-php | |
// http://spiechu.pl/2012/05/26/w-miare-bezpieczne-uruchamianie-skryptow-php-poprzez-shell_exec | |
class ICMPPing | |
{ | |
const TYPE_REQUEST = 0x08; | |
const TYPE_RESPONSE = 0x00; |
This file contains hidden or 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 'dart:isolate'; | |
import 'dart:html'; | |
/** | |
* Isolate running asynchronously. | |
*/ | |
void numCounter() { | |
port.receive((msg, replyTo) { | |
Element h1 = query("h1#counter${msg['id']}"); | |
int counter = 0; |
This file contains hidden or 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
// Typical Java package declaration. | |
package pl.spiechu.hashutils | |
// Typical class imports. More than one in curly brackets. | |
// Java classes work just fine in Scala. | |
import java.io.{ File, FileInputStream } | |
import java.security.MessageDigest | |
/** | |
* Singleton object. You cannot create an instance using 'new'. |
This file contains hidden or 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 | |
interface CommonErrorCodes { | |
const ERR_STATUS_OK = 0; | |
const ERR_STATUS_NOT_FOUND = 1; | |
const ERR_STATUS_INVALID = 2; | |
const CHECK_ERR_PREFIX = 'ERR_'; | |
} |
This file contains hidden or 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 | |
$standardTasks = [ | |
// nothing special here, take $val and return trimmed | |
'standardTrim' => function($val) { | |
return trim($val); | |
}, | |
// this one is better, check string encoding and convert to ASCII counterpart | |
'convertToASCII' => function($val) { |
This file contains hidden or 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 | |
namespace MyProject\MyBundle; | |
class AsciiConverter implements StringProcessorInterface | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getProccessedString($string) { |
This file contains hidden or 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
const express = require('express'); | |
const app = express(); | |
// define app logging, middleware, view engine etc. | |
// make sure you | |
// npm install advanced-throttle --save | |
const Throttle = require('advanced-throttle'); | |
// boring factory... |