Skip to content

Instantly share code, notes, and snippets.

@stansidel
stansidel / prepare-commit-msg
Last active July 28, 2023 09:51
Add ticket number from the branch to commit messages
View prepare-commit-msg
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
# Skips this step if the commit message already starts with "[".
# Modified from the stackoverflow answer here: http://stackoverflow.com/a/11524807/151445
#
# Succeed on all merge messages, as evidenced by MERGE_MSG existing
[ -f $GIT_DIR/MERGE_MSG ] && exit 0
@stansidel
stansidel / main.dart
Created September 6, 2021 07:38
Flutter Cupertino Basic Navigation
View main.dart
import 'package:flutter/cupertino.dart';
void main() {
runApp(CupertinoApp(
home: MyAppHome(), // becomes the route named '/'
routes: <String, WidgetBuilder>{
'/a': (BuildContext context) => const MyPage(title: 'page A'),
'/b': (BuildContext context) => const MyPage(title: 'page B'),
'/c': (BuildContext context) => const MyPage(title: 'page C'),
},
@stansidel
stansidel / gist:6c930286b67c58b0d1bd8240ca8cab50
Created April 9, 2021 07:07
Tinkoff Subscription fail request
View gist:6c930286b67c58b0d1bd8240ca8cab50
GET /subscription/fail HTTP/1.1
Host: aa062f5____.ngrok.io
Upgrade-Insecure-Requests: 1
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 Edg/89.0.774.68
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: navigate
Sec-Fetch-Dest: document
Referer: https://securepay.tinkoff.ru/
@stansidel
stansidel / controllers.application\.js
Last active October 27, 2020 12:45
Nested Routes
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@stansidel
stansidel / components.simple-drag\.js
Last active October 14, 2020 19:46 — forked from dgavey/components.simple-drag\.js
Simple Drag Example
View components.simple-drag\.js
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class SimpleDrag extends Component {
@tracked statusText = "";
@tracked overDropZone = false;
@action dragHasStarted() {
@stansidel
stansidel / index.html
Last active October 9, 2020 06:05
Independently scrollable 3-paner with a header for 2 panes
View index.html
<!DOCTYPE html>
<html>
<head>
<style>
.container {
width: 100%;
height: 100vh;
display: flex;
flex-wrap: wrap;
View assign_in_container.cpp
#include <iostream>
#include <string>
#include <utility>
#include <future>
#include <mutex>
#include <random>
#include <thread>
#include <chrono>
#include <sstream>
View properties.swift
import Foundation
class MyClass {
private let name: String
init(name: String) {
self.name = name
}
// Pure computed property, cannot be set. Behaves like a constant field for the user of the class
var computed: String {
@stansidel
stansidel / class-vs-struct.swift
Created June 19, 2019 05:55
Мутабельность классов и структур
View class-vs-struct.swift
class MyClass {
var name: String
init(name: String) {
self.name = name
}
}
var mc1 = MyClass(name: "Name 1")
View gist:0ac64647d3a55338e65de0839c40132a
<script>
$(document).on('click', '#make_header_red', function() {
$('#header').css('font-color', 'red');
});
</script>