Skip to content

Instantly share code, notes, and snippets.

@paulmwatson
paulmwatson / cypress_test_404_spec.js
Created January 14, 2021 08:33
Testing a 404 page with Cypress
cy.visit('/404')
//=> Test fails
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes but does not test the HTTP code was 404
cy.request({url: '/404', failOnStatusCode: false}).its('status').should('equal', 404)
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes, tests that the HTTP code was 404, and tests page was visited
@bhurling
bhurling / FlagToEmoji.kt
Last active September 14, 2022 04:30
Kotlin way of converting country codes to emoji flags
import java.util.Locale
fun countryCodeToEmojiFlag(countryCode: String) {
return countryCode
.toUpperCase(Locale.US)
.map { char ->
Character.codePointAt("$char", 0) - 0x41 + 0x1F1E6
}
.map { codePoint ->
Character.toChars(codePoint)
@south37
south37 / 00_timeline.md
Last active March 13, 2024 11:38
ISUCON Cheat Sheet
@KodrAus
KodrAus / Profile Rust on Linux.md
Last active November 14, 2023 17:19
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.

@Tblue
Tblue / mozlz4a.py
Last active March 30, 2024 08:45
MozLz4a compression/decompression utility
#!/usr/bin/env python3
# vim: sw=4 ts=4 et tw=100 cc=+1
#
####################################################################################################
# DESCRIPTION #
####################################################################################################
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
@komiya-atsushi
komiya-atsushi / Base64Demo.java
Created August 31, 2014 17:51
Java 8 より導入された java.util.Base64 の利用デモ。
import java.io.PrintStream;
import java.util.Base64;
/**
* Java 8 より導入された java.util.Base64 の利用デモ。
*/
public class Base64Demo {
private static final PrintStream o = System.out;
public static void main(String[] args) {
題目 | 登壇者
---------------------------------------------------------------------------------------
講演「プログラミングコンテストとdata science」 | iwi
講演「プログラミングコンテストの大衆化」 | colun
講演「AOJを支える技術」 | 会津大の人?
講演「ICFPCのおもいで」 | shinh
講演「ICPC審判団の考えていること」 | kinaba
対談「この過去問がすごい!」 | simezi_tan,Komaki
会談「問題セットのつくりかた」 | rng_58,chokudai,LayCurse
@iwiwi
iwiwi / qsub.rb
Last active April 27, 2016 06:13
Torque job machine-gun
#!/usr/bin/env ruby
#
# qsub.rb --- Torque job machine-gun
#
# Usage:
# 1. Rewrite the shell script template & parameters
# 2. Execute
# $ qsub.rb (cat) --> Output generated shell scripts
# $ qsub.rb sh --> Execute locally