Skip to content

Instantly share code, notes, and snippets.

View Hultner's full-sized avatar
📯
What are you trying to shell?

Alexander Hultnér Hultner

📯
What are you trying to shell?
View GitHub Profile
@irisjae
irisjae / eas-analytics
Last active August 2, 2023 11:22
EAS patches for offline
--- a/eas-cli/build/analytics/AnalyticsManager.js
+++ b/eas-cli/build/analytics/AnalyticsManager.js
@@ -91,31 +91,31 @@ exports.getAnalyticsEnabledAsync = getAnalyticsEnabledAsync;
* Create an instance of Analytics based on the user's analytics enabled preferences.
*/
async function createAnalyticsAsync() {
- // TODO: remove after some time
- const amplitudeEnabled = await UserSettings_1.default.getAsync(USER_SETTINGS_KEY_AMPLITUDE_ENABLED, null);
- if (amplitudeEnabled !== null) {
- await UserSettings_1.default.setAsync(USER_SETTINGS_KEY_ANALYTICS_ENABLED, amplitudeEnabled);
@henryivesjones
henryivesjones / postgresql_date_timestamp_interval_cheat_sheet.md
Created February 14, 2023 16:56
PostgreSQL DATE, TIMESTAMP, and INTERVAL cheat sheet

PostgreSQL DATE, TIMESTAMP, and INTERVAL cheat sheet

Working with DATE, TIMESTAMP, and INTERVAL in PostgreSQL can be confusing. In this article I will go over the three date/time related data types, and the two most useful date/time functions: DATE_PART and DATE_TRUNC. Finally, I will provide some real life examples of how these types and functions can be used within queries.

Types

PostgreSQL Date/Time Documentation

DATE

The DATE type contains the year, month, and day of a date. It is not possible to do any type of time related functions on a DATE without first converting it to a TIMESTAMP. Subtracting two DATE values from one another results in an INT representing the # of days between.

TIMESTAMP

The TIMESTAMP type contains a year, month, day, hour, minute, second, and microsecond. This is the type that I most often use.

@zzzeek
zzzeek / sql.py
Last active August 15, 2023 10:00
The SQL is just as easy as an ORM challenge
""" "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.
@sigmaris
sigmaris / build_qemu_debian_image.sh
Last active March 21, 2024 06:13
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP
@makasim
makasim / docker-compose.yml
Last active January 1, 2024 11:24
Secure Docker Registry with Traefik and LetsEncrypt
version: '3.1'
services:
registry:
restart: always
image: registry:2
volumes:
- registry:/var/lib/registry
environment:
- REGISTRY_HTTP_ADDR=0.0.0.0:5000
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
anonymous
anonymous / untrusted-lvl3-solution.js
Created February 22, 2017 17:27
Solution to level 3 in Untrusted: http://alex.nisnevich.com/untrusted/
/************************
* validationEngaged.js *
************************
*
* They're really on to us now! The validateLevel function
* has been activated to enforce constraints on what you can
* do. In this case, you're not allowed to remove any blocks.
*
* They're doing all they can to keep you here. But you
* can still outsmart them.
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@coffeewasmyidea
coffeewasmyidea / views.py
Created November 24, 2016 20:40
CBV with Multiple forms. Based on UpdateView.
class MultipleFormsView(ItemUpdate):
model = MyModel
template_name = ''
success_url = reverse_lazy('')
form_class = Form1
second_form_class = Form2
third_form_class = Form3
@jasonwatt
jasonwatt / GAME_MASTER_v0_1.decoded.categorized.json
Last active November 27, 2018 19:39
OUTDATED - v0.29 Client - GAME_MASTER_v0_1.decoded.categorized.json
{
"Badges": [
{
"TemplateId": "BADGE_BATTLE_ATTACK_WON",
"Badge": {
"BadgeType": "BADGE_BATTLE_ATTACK_WON",
"BadgeRanks": 4,
"Targets": [10, 100, 1000]
}
}, {