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
interface ConfigFileInterface | |
{ | |
public function load(); | |
public function save(); | |
} | |
class YamlConfigFile implements ConfigFileInterface | |
{ | |
public function load() | |
{ |
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
//normal for in | |
fun fizzBuzz(start: Int = 1, end: Int = 15) { | |
for(foobar in start..end) { | |
println(when { | |
foobar % 5 == 0 && foobar % 3 == 0 -> "FizzBuzz" | |
foobar % 3 == 0 -> "Fizz" | |
foobar % 5 == 0 -> "Buzz" | |
else -> "$foobar" | |
}) | |
} |
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
//idiotcoder.com | |
class Post | |
{ | |
private long timestamp = 0; | |
public long HourAgo { | |
get { return timestamp - (60 * 60); } | |
} | |
public Post(long unixTimestamp) |
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
namespace CvsProject | |
{ | |
internal class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var filename = "csvfile.csv"; | |
var reader = new CsvReader(filename); | |
reader.ParseContent(); |
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 | |
$app = new \Slim\App(); | |
$app->group('/users/{id:[0-9]+}', function () { | |
$this->map(['GET', 'DELETE', 'PATCH', 'PUT'], '', function ($request, $response, $args) { | |
// Find, delete, patch or replace user identified by $args['id'] | |
})->setName('user'); | |
$this->get('/reset-password', function ($request, $response, $args) { | |
// Route for /users/{id:[0-9]+}/reset-password | |
// Reset the password for user identified by $args['id'] |
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
def example(&ex) | |
ex.call() | |
end |
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
# idiotcoder.com | |
def example(&ex) | |
ex.call() | |
end | |
example &-> { | |
puts "sup" | |
} |
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 Route | |
def initialize(@route = "") | |
end | |
def route | |
@route | |
end | |
end | |
class RouteContainer |
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
#idiotcoder.com | |
#eatcodegame.com | |
class RouteParser | |
@default_regex_replacement = "w+" | |
getter regex_variables = {} of String => String | |
getter default_variables = {} of String => String | |
getter matched_variables = [] of String |
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 say(a) | |
{ | |
splitUp = function(data) { | |
dataArray = data.split("") | |
stringArray = []; | |
for(x = 0; x < dataArray.length; x++) { | |
if(dataArray[x].match(/[a-zA-Z0-9]/)) { | |
stringArray[stringArray.length++] = dataArray[x]; | |
} | |
} |
OlderNewer