This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HttpStatusMapper { | |
// can't be 'continue' because it is reserved name | |
static const Map<String, dynamic> continueCode = { | |
'status': 'continue', | |
'code': 100, | |
}; | |
static const Map<String, dynamic> switchingProtocols = { | |
'status': 'Switching Protocols', | |
'code': 101, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:your_project_name/config/http_status_constants.dart'; | |
int responseCodeHelper(code) { | |
switch (code) { | |
case HttpStatusConstants.continueCode: | |
return HttpStatusConstants.continueCode; | |
case HttpStatusConstants.switchingProtocols: | |
return HttpStatusConstants.switchingProtocols; | |
case HttpStatusConstants.processing: | |
return HttpStatusConstants.processing; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool isInept() { | |
return [ | |
district, | |
extraInfo, | |
name, | |
number, | |
].contains(null); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// maybe this file must be a StateFull | |
late final scrollController = ScrollController()..addListener(onScroll); | |
void onScroll() { | |
if (scrollController.position.pixels == 0) { | |
fetchSearch(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some spec suit | |
RSpec.describe SomeClass do | |
it 'travel back' do | |
travel_to Time.local(1994) do | |
puts Time.zone.now | |
# outputs: '1994-mm-dd ...' | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"editor.rulers": [ | |
{ | |
"column": 80, | |
"color": "#337633" | |
}, | |
{ | |
"column": 100, | |
"color": "#C8CA33" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.eager_load! | |
ActiveRecord::Base.descendants # all models and its attributes | |
ApplicationRecord.descendants.collect(&:name) # filtering model names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
GIT_DIR=$(git rev-parse --git-dir) | |
echo "Preparing hooks..." | |
# These commands will create symlink to our pre-commit script | |
ln -s ../../.github/pre-commit.bash $GIT_DIR/hooks/pre-commit | |
ln -s ../../.github/pre-push.bash $GIT_DIR/hooks/pre-push | |
ln -s ../../.github/post-checkout.bash $GIT_DIR/hooks/post-checkout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# File checkout | |
if [ "$3" == "0" ]; then exit; fi | |
NUM_CHECKOUTS=`git reflog --date=local | grep -o ${BRANCH_NAME} | wc -l` | |
# If the refs of the previous and new heads are the same | |
# AND the number of checkouts equals one, a new branch has been created | |
if [ "$1" == "$2" ] && [ ${NUM_CHECKOUTS} -eq 1 ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Running pre-commit hook" | |
.github/run-rubocop.bash | |
# $? stores exit value of the last command | |
if [ $? -ne 0 ]; then | |
echo "Rubocop detected offences in your code. Check it out before proceed" | |
exit 1 | |
fi |