(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/sh | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
@view_config(context=Forbidden, renderer='renderer.pt') | |
def forbidden(context, request): | |
# If unauthenticated, redirect to sign in | |
if( | |
Authenticated not in request.effective_principals | |
and request.unauthenticated_userid is None | |
): | |
raise HTTPFound('auth redirect') | |
# If unverified and verification would help, redirect to verification |
// ------------ | |
// counterStore.js | |
// ------------ | |
import { | |
INCREMENT_COUNTER, | |
DECREMENT_COUNTER | |
} from '../constants/ActionTypes'; | |
const initialState = { counter: 0 }; |
"""Rolling time window counter and rate limit using Redis. | |
Use Redis sorted sets to do a rolling time window counters and limiters. These are useful for preventing denial of service, flood and reputation attack against site elements which trigegr outgoing action (email, SMS). | |
Example how to do a Colander validator which checks that the form has not been submitted too many times within the time period:: | |
import colander as s | |
@c.deferred | |
def throttle_invites_validator(node, kw): |
The issue:
..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.
(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)
touch-action
CSS property can be used to disable this behaviour.
touch-action: manipulation
The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.
Result: 1 | |
Items { | |
TemplateId: "BADGE_BATTLE_ATTACK_WON" | |
Badge { | |
BadgeType: BADGE_BATTLE_ATTACK_WON | |
BadgeRanks: 4 | |
Targets: "\nd\350\007" | |
} | |
} | |
Items { |
""" "Writing SQL is just as fast as using an ORM" proof of concept | |
Below is a simple Python object model, where we represent a database that | |
stores the names of employees at a company, some of whom are "engineers", | |
and a list of the jobs they do and the programming languages they use. | |
We'd like to persist the state represented by this Python object model | |
in a relational database, using our Python objects as a start. Then we'd | |
like to write SQL queries for rows in this database, and we get back instances | |
of Python objects exactly as they were created. |
This is a Rocket.Chat incoming web hook. Hook gets an array of "messages" and silently creates chat messages directly in the Rocket's database without disturbing users with notifications or alerts - messages just appear in the channels. Messages appear silently even if the user has the channel openned: no refresh or re-enter is required (this is not this script's feature, it's how Rocket works).
This script can post messages to channels and groups by name (if message destination set to #name
), or by api roomId (no prefixes in destination). And it can post DM to a user (if destination is set to @username
). Please note, in this case DM between message author and destination user must already be created.
Note. Rocket.Chat's server version 6 has undergone significant changes. As a result, now there are two script versions: silent-post-whs-v5.js
for server version 5 and silent-post-whs-v6.js
for version 6. However, these scripts use an un
# MIT No Attribution | |
# | |
# Copyright 2022 Ben Kehoe | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
# software and associated documentation files (the "Software"), to deal in the Software | |
# without restriction, including without limitation the rights to use, copy, modify, | |
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so. | |
# |