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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #define fx for(i = 0; i < x; i++) | |
| #define fy for(j = 0; j < y; j++) | |
| #define nl printf("\n"); | |
| #define apc ap[j * x + i] | |
| #define dc int i, j; |
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
| class Singleton(object): | |
| _instance = None | |
| def __new__(cls, *args, **kwargs): | |
| if not cls._instance: | |
| cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs) | |
| return cls._instance |
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
| class Allergen(models.Model): | |
| name = models.CharField(max_length=256, null=False, blank=False) | |
| class Ingredient(models.Model): | |
| name = models.CharField(max_length=255, null=False, blank=False) | |
| description = models.TextField(null=True, blank=False) | |
| allergens = models.ManyToManyField(Allergen) # -> this fields creates table | |
| may_contain = models.ManyToManyField(Extra) # between Ingredient and Allergen | |
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
| class Event: | |
| def __init__(self): | |
| self._subscribers = set() | |
| @property | |
| def subscribers(self): | |
| return self._subscribers.copy() |
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
| /** | |
| * Check if cached record is valid. | |
| * @param {object} cachedValue - cache record | |
| * @param {number} cacheTime - time to cache | |
| * @returns {bool} | |
| */ | |
| const isCached = (cachedValue, cacheTime) => | |
| (new Date() - cachedValue.at) / 1000 < cacheTime; | |
| /** |
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 React, { unstable_Profiler as Profiler } from "react"; | |
| /** | |
| * Profiles storage. | |
| */ | |
| const profiles = {}; | |
| /** | |
| * Calculate weighted average. | |
| * @param {number} time - time passed |
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 ch.bildspur.postfx.builder.*; | |
| import ch.bildspur.postfx.pass.*; | |
| import ch.bildspur.postfx.*; | |
| /** | |
| * varaibles | |
| */ | |
| float | |
| cx, | |
| cy, |
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
| float A = -2.337, | |
| B = -2.337, | |
| C = 0.2553, | |
| D = 1.378, | |
| dx = 0.1, | |
| dy = 0.1; | |
| float X() { | |
| return A * sin(dx * A) - sin(dy * D); | |
| } |
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
| (function (window) { | |
| /* reference exposed api based on browser */ | |
| const API = window.chrome || window.browser; | |
| /* IP address used for calls */ | |
| let IPAddress = "0.0.0.0"; | |
| /* polling period in miliseconds */ |
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
| using System; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| using System.Collections.Generic; | |
| using System.Collections.Concurrent; | |
| namespace dotnetpad | |
| { | |
| class Program | |
| { |
OlderNewer