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
var db = mongoose.connect('mongodb://localhost:27017/DB'); | |
// In middleware | |
app.use(function (req, res, next) { | |
// action after response | |
var afterResponse = function() { | |
logger.info({req: req}, "End request"); | |
// any other clean ups |
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
heroku login | |
heroku create your-app-name | |
## Existing .git | |
git push heroku master | |
## create instance | |
heroku ps:scale web=1 | |
## your-app-name.herokuapp.com |
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 | |
// Print a list of common divisors given two integers. | |
function generate($min, $max) { | |
// Base case: max >= min > 1 | |
if ($min <= 1 || $min > $max) { | |
return; | |
} | |
// A divisor if, max modulo min has 0 remainder, print it. | |
echo $max % $min == 0 ? " $min " : ''; |
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
// A Unit test template for Tape | |
// See 5 Questions every unit test must answer: | |
// https://medium.com/javascript-scene/what-every-unit-test-needs-f6cd34d9836d | |
import test from 'tape'; | |
test('What are you testing?', assert => { | |
const msg = 'what should it do?' | |
const actual = 'what was the output?'; |
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
fields=0 48 17 18 38 39 40 2 46 47 49 1 | |
sort_key=39 | |
sort_direction=0 | |
hide_threads=0 | |
hide_kernel_threads=0 | |
hide_userland_threads=0 | |
shadow_other_users=0 | |
highlight_base_name=0 | |
highlight_megabytes=1 | |
highlight_threads=0 |
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
on run {input, parameters} | |
set clickedValue to "Continue" | |
repeat while clickedValue is not "Don't Continue" | |
display notification "Executing command 'caffeinate -t 9600' " with title "Awake Notification" subtitle "Caffeinate started." | |
if (do shell script "caffeinate -t 9600") is "" then | |
set theDialogText to "Awake duration ended. Would you like to continue?" | |
set theDialog to display dialog theDialogText giving up after 5 buttons {"Don't Continue", "Continue"} default button "Continue" | |
set clickedValue to button returned of theDialog | |
end if |
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
set tabsize 2 | |
set tabstospaces | |
syntax "fish" "\.fish$" | |
## Blocks | |
color brightwhite,blue "\<(function|begin|end)\>" | |
## Structure | |
color brightblue "\<(switch|case|if|else|do|while|for|in|begin|return|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
on run {input, parameters} | |
display dialog "Click 'Continue' to lock screen." giving up after 5 buttons {"Cancel", "Continue"} default button "Continue" cancel | |
button "Cancel" | |
--> Result: {{button returned:"Continue", gave up:true} | |
return input | |
end run | |
on run {input, parameters} | |
do shell script "'/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession' -suspend" |
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 docker-sh | |
if count $argv > /dev/null | |
command docker exec -ti $argv bash | |
else | |
echo "Usage: docker-sh CONTAINER_ID" | |
end | |
end |
NewerOlder