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 | |
# | |
# Description: | |
# downloads mendix of the specified version and places it in `$HOME/.mendix/{{specified-version}}` | |
# | |
# Usage: | |
# mendix-downloader.sh {{specify-the-desired-version}} | |
# (e.g. mendix-downloader.sh 7.23.7.55882) | |
# | |
MXBUILD_VERSION=$1 |
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
sudo rm /var/lib/ubuntu-release-upgrader/release-upgrade-available | |
sudo /usr/lib/ubuntu-release-upgrader/release-upgrade-motd |
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
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
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 i18n(template) { | |
for (var | |
info = i18n.db[i18n.locale][template.join('\x01')], | |
out = [info.t[0]], | |
i = 1, length = info.t.length; i < length; i++ | |
) out[i] = arguments[1 + info.v[i - 1]] + info.t[i]; | |
return out.join(''); | |
} | |
i18n.locale = 'en'; | |
i18n.db = {}; |
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
// with arrays | |
const dupArr = [1, 1, 2, 3, 1]; | |
const uniArr = [...(new Set(dupArr))]; | |
// [1, 2, 3] | |
// with objects on a key. | |
const dupObj = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }, { id: 1, value: 'c' }]; | |
const uniKeys = [...(new Set(dupObj.map(({ id }) => id)))]; | |
// [ '1', '2' ] |
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/sh | |
# Install Homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# homebrew taps | |
brew tap caskroom/cask | |
brew tap caskroom/versions | |
brew tap caskroom/fonts | |
# homebrew apps |
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
<?php | |
$usersQuery = \App\User::query(); | |
$usersQuery->where('type', '=', 'client'); | |
foreach(generate($usersQuery) as $user) { | |
// Do something with that user | |
} |
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
(irm https://raw.githubusercontent.com/git-tips/tips/master/tips.json)|sort {random}|select -First 1|% {"$($_.title)`r`n$($_.tip)" } |
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
DB_HOST=mysql | |
DB_DATABASE=homestead | |
DB_USERNAME=homestead | |
DB_PASSWORD=secret |
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
/* Check if it is april fools day */ | |
var aprilFools = { | |
month: 3, | |
date: 1 | |
} | |
function isItAprilFoolDay() { | |
var now = new Date(); | |
return (now.getMonth() == aprilFools.month && now.getDate() == aprilFools.date); | |
} |
NewerOlder