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: PostgreSQL | |
-- Soft-delete duplicate transactions made by the same user | |
-- of the same organization with the same amount within 3 seconds | |
-- of the last matched transaction | |
-- The first instance of a match will have a null time_diff, so it | |
-- will naturally not get included in duplicate_transactions | |
UPDATE transactions | |
SET deleted_at = now() | |
FROM ( |
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
const processData = (event, power) => { | |
const playerChoice = event.value; | |
totalCost += playerChoice; | |
setRockinpower(rockinpower + power); | |
setPickedList([...pickedList, event.name]); | |
setWallet(wallet - totalCost); | |
}; |
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
const MAX_ROCKIN_POWER = 12; | |
const MIN_ROCKIN_POWER = 7; | |
const MAX_PAYOUT = 350; | |
const MIN_PAYOUT = 20; | |
const FAILURE_PAYOUT = -50; | |
useEffect(() => { | |
let newAmount = wallet; | |
let message = ''; |
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 | |
public function list_blog_posts(Request $request) | |
{ | |
$posts = BlogPost::where( | |
DB::raw("status = '" . $request->input('status') . "'") | |
)->get(); | |
$posts = $posts->filter(function($value, $key) { | |
return $value->isPublished(); |
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
<p> | |
© | |
<script>document.write(new Date().getFullYear())</script> | |
<noscript>2019</noscript> | |
Your Silly Website. All Rights Reserved. | |
</p> |
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 inactivityTime = function () { | |
var t; | |
window.onload = resetTimer; | |
// DOM Events | |
document.onmousemove = resetTimer; | |
document.onkeypress = resetTimer; | |
function inactivityLogout() { | |
// optional - turn off the event handlers | |
// useful for single page 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
restart_nginx () { | |
# path to pgrep command | |
PGREP="/usr/bin/pgrep" | |
# Httpd daemon name, | |
HTTPD="nginx" | |
# find httpd pid | |
$PGREP ${HTTPD} |
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
# By default, Docker containers run as the root user. This is bad because: | |
# 1) You're more likely to modify up settings that you shouldn't be | |
# 2) If an attacker gets access to your container - well, that's bad if they're root. | |
# Here's how you can run change a Docker container to run as a non-root user | |
## CREATE APP USER ## | |
# Create the home directory for the new app user. | |
RUN mkdir -p /home/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
table { | |
min-width: 100%; | |
margin-bottom: 2em; | |
text-align: center; | |
} | |
tbody { | |
border: 2px solid #d1d1d1; | |
border-right: none; | |
} |
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 Person = { | |
name: '', | |
init: function(name){ | |
this.name = name; | |
}, | |
speak: function(){ | |
console.log('My name is ' + this.name); | |
} | |
} |
NewerOlder