Skip to content

Instantly share code, notes, and snippets.

View RockinPaul's full-sized avatar
🐢

Paul Zarudnev RockinPaul

🐢
  • Amsterdam, Netherlands
View GitHub Profile
@RockinPaul
RockinPaul / ApiService.swift
Last active January 24, 2019 13:32
ApiService: Swift+URLSession
class ApiService {
static let sharedInstance = ApiService()
let BASE_URL = "https://restcountries.eu"
// MARK: - List of countries
func countries(_ completion: @escaping(_ result: [Country]?, _ error: Error?) -> Void) {
let urlString = BASE_URL + "/rest/v2/all"
@RockinPaul
RockinPaul / bash_profile_on_mac
Last active February 13, 2019 16:32
Creating a .bash_profile on your mac
A typical install of OS X won't create a .bash_profile for you. When you want to run functions from your command line, this is a must-have.
Start up Terminal
Type "cd ~/" to go to your home folder
Type "touch .bash_profile" to create your new file.
Edit .bash_profile with your favorite editor (or you can just type "open -e .bash_profile" to open it in TextEdit.
Type ". .bash_profile" to reload .bash_profile and update any functions you add.
/*
@RockinPaul
RockinPaul / main.dart
Created April 2, 2019 18:27 — forked from branflake2267/main.dart
Flutter - Using the future builder with infinite list view.
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@RockinPaul
RockinPaul / scaling.gml
Last active July 8, 2019 09:41
This scaling solution gives a "best fit", and can easily be adapted to suit your own base game resolution.
// Note that you can call this code in a script
// so that you can simply call the script at the start of each room.
// You can even add a final piece of code to have this
// automatically set all the views in all your rooms
// so that you only need to call it once at the start of the game.
// This code will just loop through every room in your game, destroy the default camera,
// and then create a new camera that is correct for the display size and aspect ratio,
// as well as enable a viewport in the room for the camera to act on.
var _check = true;
@RockinPaul
RockinPaul / zsh_set_env.txt
Created November 20, 2019 16:51
How to set environment variables permanently in zsh.
echo 'export ENV_VAR=12345' >> ~/.zshenv
echo $ENV_VAR // perform on relaunch of zsh to check if everything is set properly.
12345
class ScreenOne extends StatefulWidget {
@override
_ScreenOneState createState() => _ScreenOneState();
}
class _ScreenOneState extends State<ScreenOne> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@RockinPaul
RockinPaul / main.dart
Created October 20, 2020 09:08 — forked from AgainPsychoX/main.dart
Dart: Convert a `String` to a `Uint8List` and `Uint8List` to `String` (UTF-16)
import 'dart:typed_data';
void main() {
// Source
String source = 'Hello! Cześć! 你好! ご挨拶!Привет! ℌ𝔢𝔩𝔩𝔬! 🅗🅔🅛🅛🅞!';
print(source.length.toString() + ': "' + source + '" (' + source.runes.length.toString() + ')');
// String (Dart uses UTF-16) to bytes
var list = new List<int>();
import 'package:flutter/material.dart';
class Bubble extends StatelessWidget {
Bubble({this.message, this.time, this.delivered, this.isMe});
final String message, time;
final delivered, isMe;
@override
Widget build(BuildContext context) {
@RockinPaul
RockinPaul / config.yml
Created December 6, 2021 01:18 — forked from tasaquino/config.yml
CircleCI configuration for Flutter with flavors and schemes - Configuration to send beta and generate artifacts (prod flavor)
version: 2.1
jobs:
ios_distribute_beta:
macos:
xcode: "10.3.0"
working_directory: ~/flutter-app
steps:
- add_ssh_keys:
fingerprints:
- "ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab:ab"
@RockinPaul
RockinPaul / revert-a-commit.md
Created January 2, 2022 14:02 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: