Skip to content

Instantly share code, notes, and snippets.

View fredriccliver's full-sized avatar
🧭
To the north

Fredric Cliver fredriccliver

🧭
To the north
View GitHub Profile
<html>
<body>
<div style="display: flex; flex-direction: column; width: 150px">
<h1>Sign Up</h1>
<input id="email" type="text" placeholder="email" />
<input id="name" type="text" placeholder="name" />
<input id="password" type="text" placeholder="password" />
<button id="apply_button" style="margin-top: 20px">Apply</button>
<p id="warning_label">Fill contents and press the button.</p>
</div>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<!-- https://developer.mixpanel.com/docs/javascript-quickstart -->
@fredriccliver
fredriccliver / index.html
Created August 22, 2021 17:10
DOM manipulation
<html>
<head></head>
<body>
<div>John</div>
<div id="dave">Dave</div>
<div>Sally</div>
<div>Harry</div>
<div class="rich">Shore</div>
<div class="rich">Merry</div>
<div class="royal rich">Kanny</div>
window.onload = function () {
document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
anchor.addEventListener("click", function (e) {
// Get href link value
const targetUrl = this.getAttribute("href");
// Track the event name as "anchor_click" and custom field name is "target", value is the href value.
firebase.analytics().logEvent('anchor_click', { target: targetUrl});
<html>
<head></head>
<body>
<!-- Your page. -->
<script src="/__/firebase/8.9.1/firebase-app.js"></script>
<script src="/__/firebase/8.9.1/firebase-analytics.js"></script>
<script src="/__/firebase/init.js?useEmulator=true"></script>
<script>
// ...
class MyVC: UIViewController{
// ...
override func viewDidLoad() {
titleTextView.frame.size.height = titleTextView.sizeThatFits(titleTextView.frame.size).height
titleTextViewHeight.constant = titleTextView.contentSize.height
/* Class = "UILabel"; text = "Autoplay in the practice screen";*/
"23d-HD-43G.text" = "연습화면에서 자동재생";
/* Reminder Notifiction */
"g4d-df-56V.text" = "리마인더 알림"
/* Class = "UIBarButtonItem"; title = "🇬🇧"; */
"fGd-ec-54G.title" = "🇬🇧";
let vc = MyViewController()
vc.modalPresentationStyle = .popover
self.present(vc, animated: true) {
}
import LinkPresentation
// ...
let provider = LPMetadataProvider()
provider.startFetchingMetadata(for: url) { metadata, error in
guard
let metadata = metadata,
error == nil
else { return }
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
self.lastTouchPoint = touches.first?.location(in: self)
super.touchesEnded(touches, with: event)
}