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
# Connect to Redis | |
r = redis.StrictRedis(host='localhost', port=6379, db=0) | |
# Rate limiter configuration | |
MAX_REQUESTS = 5 # Maximum number of allowed requests | |
TIME_WINDOW = 60 # Sliding window size in seconds (e.g., 1 minute) | |
def is_allowed(client_id): | |
current_time = int(time.time() * 1000) # Current time in milliseconds | |
window_start = current_time - (TIME_WINDOW * 1000) # Start of sliding window |
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
import { LOCALE_ID } from '@angular/core'; | |
import { async, inject, TestBed } from '@angular/core/testing'; | |
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core'; | |
import { DateTime, Settings } from 'luxon'; | |
import { LuxonDateAdapter, LUXON_DATE_FORMATS } from './luxon-date-adapter'; | |
// avoid confusion when working with months |
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
import sublime_plugin | |
class ShowZeroWidthSpace(sublime_plugin.EventListener): | |
def on_modified_async(self, view): | |
spaces = [] | |
p = 0 | |
while True: | |
s = view.find('\u200b', p + 1) | |
if not s: |
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
/** | |
* BEM Helper methods. Inspired by http://bit.ly/1QqAOhR. | |
* Provides mixins @block, @element and @modifier. | |
* Requires SassyLists and SassyStrings. | |
*/ | |
$bem-element-separator: '__'; | |
$bem-modifier-separator: '--'; | |
/** | |
* Return a list of all of the rules within the selector |
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
// ---- | |
// Sass (v3.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
$bem-element-separator: '__'; | |
$bem-modifier-separator: '--'; | |
@function selectorToString($selector) { | |
$selector: inspect($selector); //cast to 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
$bem-element-separator: '__'; | |
$bem-modifier-separator: '--'; | |
@function selectorToString($selector) { | |
$selector: inspect($selector); //cast to string | |
$selector: str-slice($selector, 2, -2); //remove brackets |
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
$bem-element-separator: '__'; | |
$bem-modifier-separator: '--'; | |
@function selectorToString($selector) { | |
$selector: inspect($selector); //cast to string | |
$selector: str-slice($selector, 2, -2); //remove brackets |
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
<div class="class">asd</div> |
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
$bem-element-separator: '__'; | |
$bem-modifier-separator: '--'; | |
@function selectorToString($selector) { | |
$selector: inspect($selector); //cast to string | |
$selector: str-slice($selector, 2, -2); //remove brackets |
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
import datetime | |
import re | |
from django.conf import settings | |
from django.forms.extras import SelectDateWidget | |
from django.forms.widgets import Widget, Select | |
from django.utils import datetime_safe, six | |
from django.utils.dates import MONTHS | |
from django.utils.formats import get_format | |
from django.utils.safestring import mark_safe |
NewerOlder