This file contains 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
def auth | |
user = User.find_by(username: params[:username]) | |
if user&.check_password(params[:password]) | |
render json: user | |
else | |
render json: { errors: ['wrong username or password'] }, status: :unauthorized | |
end | |
end |
This file contains 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
mv ~/.steam/steam/* ~/.local/share/Steam/ | |
rmdir ~/.steam/steam | |
ln -s ../.local/share/Steam ~/.steam/steam | |
rm -rf ~/.steam/bin |
This file contains 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 | |
mkdir /tmp/GitEye | |
sudo unzip -d /tmp/GitEye ~/Downloads/GitEye*.zip | |
sudo chown -R root:root /tmp/GitEye | |
sudo mv /tmp/GitEye /opt/GitEye | |
sudo ln -s /opt/GitEye/GitEye /usr/local/bin/GitEye | |
sudo rm -rf /tmp/GitEye | |
#Create a Desktop Entry |
This file contains 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 | |
# check m4 already installed | |
whereis m4 | |
# install automake | |
sudo apt install automake | |
# install pkg-config | |
sudo apt install pkg-config | |
# install watchman | |
git clone https://github.com/facebook/watchman.git |
This file contains 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
#app { | |
font-family: "Avenir", Helvetica, Arial, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
text-align: center; | |
color: #2c3e50; | |
margin-top: 40px; | |
margin-bottom: 60px; | |
max-width: 800px; | |
margin-left: auto; |
This file contains 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 | |
# this will find all node_modules above your path and will remove them | |
find . | grep /node_modules$ | grep -v /node_modules/ | xargs rm -fRv |
This file contains 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
// function declaration | |
function get<T>(options: string): T { | |
// do stuff | |
} | |
// invocation | |
get<Object>(options); |
This file contains 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
function calculateSum(firstUserInput: unknown, secondUserInput: unknown) { | |
if (typeof firstUserInput !== "number") { | |
throw new TypeError("first provided value has a wrong type. Should be a number") | |
} | |
if (typeof secondUserInput !== "number") { | |
throw new TypeError("second provided value has a wrong type. Should be a number") | |
} | |
return firstUserInput + secondUserInput; | |
} | |
let calc1 = calculateSum('sa', 'dd') |
This file contains 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 Utility { | |
collectionFor(name: string): Characters | |
collectionFor(name: string, type: 'removed'): number | |
collectionFor(name: string, type?: string | undefined): CharsOrNum { | |
if (typeof type === 'undefined') type = 'characters' | |
let constantName | |
const col1 = ['meny', 'men', 'mem', 'me'] | |
const col2 = ['peny', 'pen', 'pem'] | |
if (type === 'characters') { | |
constantName = `${name}_${type}` |
This file contains 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
type Admin = { name: string, age: number, position: "admin" }; | |
// Type of "admin" is "{ position: "admin" }" | |
const admin: Omit<Admin, "age" | "name"> = { position: "admin" } |