Skip to content

Instantly share code, notes, and snippets.

View s0nerik's full-sized avatar
🇺🇦

Alex Isaienko s0nerik

🇺🇦
View GitHub Profile
def string1 = """\
001001
000101
000101
"""
def string2 = """\
10
01
01
@s0nerik
s0nerik / designer.html
Created October 13, 2015 17:48
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-pages/core-pages.html">
<polymer-element name="my-element">
public struct AnyCodable {
let value: Any
public init(_ value: Any) {
self.value = value
}
}
extension AnyCodable: Codable {
public init(from decoder: Decoder) throws {
@s0nerik
s0nerik / update_nested_packages.sh
Created October 24, 2019 10:52
Flutter: update packages for all nested flutter projects
find . -name "pubspec.yaml" -execdir sh -c 'rm pubspec.lock; flutter packages get' \;
@s0nerik
s0nerik / clear.sh
Created November 14, 2019 19:51
Clear dart analysis server cache (makes IDE suggestions faster)
rm -rf ~/.dartServer/.analysis-driver
@s0nerik
s0nerik / commands.md
Created October 10, 2019 10:18
Useful imagemagick commands for developers

Tint icon:

convert icon.png -fill <color> -colorize 100 out.png
@s0nerik
s0nerik / _flutter_version.md
Last active March 28, 2020 02:31
Flutter version changer

How it works

This script creates/maintains a symlink to the Flutter SDK of choice. It provides a way to quickly switch Flutter SDK version globally for the whole system.

How to use it

  1. Put flutter_version.sh into your home folder
  2. Run chmod +x flutter_version.sh
  3. Replace ~/Documents/SDKs on line 16 with a path to the folder where you want to store the Flutter SDK versions
  4. Download and put whichever versions of flutter you'd like to switch between into <SDKs path>/flutter_versions folder and name them conveniently. Something like 1.12 and 1.16_beta will work well.
  5. Add /flutter/bin into PATH
@s0nerik
s0nerik / main.dart
Last active April 24, 2020 18:34
Color calc
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@s0nerik
s0nerik / main.dart
Created May 13, 2020 14:13
Dart const List
main() {
final list1 = const <int>[];
final list2 = const <int>[];
print(identical(list1, list2));
list1.add(666);
print(list1[0]);
print(list2[0]);
}
@s0nerik
s0nerik / main.dart
Created May 14, 2020 14:09
Dart sucks
void main() {
final iterable = [1].map((x) => x * 2);
x(iterable);
}
void x(List<int> ints) {
print('Hello');
}