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
# 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
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
<?php | |
include 'remove-comments.php' |
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
wpcf7_add_shortcode('postdropdown', 'createbox', true); | |
function createbox(){ | |
global $post; | |
extract( shortcode_atts( array( 'post_type' => 'some_post_type',), $atts ) ); | |
$args = array('post_type' => $post_type ); | |
$myposts = get_posts( $args ); | |
$output = "<select name='postType' id='postType' onchange='document.getElementById(\"postType\").value=this.value;'><option></option>"; | |
foreach ( $myposts as $post ) : setup_postdata($post); | |
$title = get_the_title(); | |
$output .= "<option value='$title'> $title </option>"; |
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 gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var babelify = require('babelify'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var uglify = require('gulp-uglify'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var livereload = require('gulp-livereload'); |
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
// 1. Enter sheet name where data is to be written below | |
var SHEET_NAME = "Sheet Name"; | |
// 2. Run > setup | |
// | |
// 3. Publish > Deploy as web app | |
// - enter Project Version name and click 'Save New Version' | |
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously) | |
// | |
// 4. Copy the 'Current web app URL' and post this in your form/script action |
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
/* Here's some examples of IE filters for backgrounds with opacity. The first 2 chars of the hex value are the | |
* opacity values. There are 10 classes to help narrow down which opacity value you might need. | |
*/ | |
.dark-90 { | |
background-color: rgba(0, 0, 0, 0.9); | |
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#E6000000,endColorstr=#E6000000); | |
} | |
.dark-80 { |
NewerOlder