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
-- Lua Table utility helper | |
-- Inspired by: https://laravel.com/docs/8.x/collections | |
Item = {} | |
Item.__index = Item | |
-- initializer | |
function Item:create(items) | |
assert(type(items) == 'table', 'Item expects a table.') | |
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
-- Binser is a lua serializer: https://github.com/bakpakin/binser | |
local Binser = 'vendor.binser.binser' | |
local Saver = {} | |
-- Write to save file | |
-- | |
function Saver:save(name, data) | |
love.filesystem.write(name .. '.txt', Binser.serialize(data)) | |
return data |
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
-- Love2D initialization | |
-- | |
function love.load() | |
loadGame('my-game') | |
end | |
---- ---- ---- ---- | |
-- New Game | |
-- |
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 ListNode: | |
def __init__(self, x): | |
self.val = x | |
self.next = None | |
class Utilities: | |
def reverseList(head: ListNode): | |
currPtr = head | |
prevPtr = None |
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 ListNode: | |
def __init__(self, x): | |
self.val = x | |
self.next = None | |
class MergeSort: | |
def __init__(self, head: ListNode): | |
self.head = None | |
def sortList(self, head: ListNode): |
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
using System; | |
using System.Collections.Generic; | |
using Microsoft.Xna.Framework; | |
using MonoGame.Extended; | |
using MonoGame.Extended.Shapes; | |
namespace EGen.Map | |
{ | |
public class Grid | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using Microsoft.Xna.Framework; | |
using MonoGame.Extended; | |
using MonoGame.Extended.Shapes; | |
namespace EGen.Map | |
{ | |
public class Grid | |
{ |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |
</configSections> | |
<log4net> | |
<appender name="TraceAppender" type="log4net.Appender.TraceAppender"> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="[%date] %level (%logger:%line) - %message%newline" /> | |
</layout> |
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
# Simple Node definition with value and next pointer. | |
class Node: | |
def __init__(self, value = 0): | |
self.value = value | |
self.next = None | |
for v in values: | |
self.add(v) | |
def __iter__(self): |
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 divisors(num): | |
return [x in range(1, num // 2) if num % x == 0]; |
NewerOlder