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 | |
use Swoole\Coroutine as Co; | |
Co\run(function () { | |
for ($i = 0; $i < 100; $i++) { | |
go(function () use($i) { | |
usleep(1_000_00 * mt_rand(1,10)); | |
echo "Coroutine $i is done.\n"; | |
}); |
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 | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\Str; | |
class SetModelAttributes extends Command | |
{ |
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
echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc | |
echo 'export LDFLAGS="-L/usr/local/opt/openssl@3/lib"' >> ~/.zshrc | |
echo 'export CPPFLAGS="-I/usr/local/opt/openssl@3/include"' >> ~/.zshrc | |
echo 'export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"' >> ~/.zshrc | |
brew install pcre2 | |
brew reinstall openssl && brew unlink openssl && brew link openssl --force | |
pecl install swoole |
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 -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install zsh zsh-syntax-highlighting terraform nvm wget ab wrk nano gpg | |
# nano highlighting | |
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh | |
# Oh my ZSH | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
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
PROJECT_NAME="ignas.tech" | |
# Replace the line of the given line number with the given replacement in the given file. | |
function replace_string() { | |
local file="$1" | |
local find="$2" | |
local replacement="$3" | |
# Escape replacement | |
replacement_escaped=$(echo "$replacement" | sed -e 's/[]\/$*.^[]/\\&/g') |
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
import React from 'react' | |
import { Root } from 'native-base' | |
import { createDrawerNavigator, createStackNavigator } from 'react-navigation' | |
import { Dimensions } from 'react-native' | |
import About from './screens/about' | |
import Home from './screens/home' | |
import Sidebar from './screens/sidebar' | |
import Splash from './screens/splash' | |
const deviceWidth = Dimensions.get('window').width |
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 | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateJobsTable extends Migration | |
{ | |
/** | |
* Run the migrations. |
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 | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap caskroom/cask | |
brew cask install google-chrome iterm2 sequel-pro vagrant virtualbox slack spotify boom bettertouchtool vlc phpstorm basecamp bittorrent zsh | |
brew install git | |
mv /usr/local/Caskroom/bittorrent/latest/Bittorrent.app /Applications/Bittorrent.app |
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 | |
namespace App\Libraries\Date; | |
use Carbon\Carbon; | |
/** | |
* Class DateRange | |
* | |
* @package App\Libraries\Date |
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
import Dexie from 'dexie' | |
/** | |
* Usage: db.table_a.with('table_a_children', 'parent_id', 'children', 'id') | |
* | |
* This will return all items from table 'table_a' | |
* where each item will have a 'children' array with linked records from 'table_a_children' table | |
*/ | |
Dexie.addons.push((db) => { | |
/** |
NewerOlder