Skip to content

Instantly share code, notes, and snippets.

@ewingd
ewingd / init.vim
Last active May 15, 2020 12:27
Neovim Configuration - PHPStorm connection
call plug#begin('~/AppData/Local/nvim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'beeender/Comrade'
Plug 'Shougo/deoplete.nvim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'StanAngeloff/php.vim'
Plug 'jwalton512/vim-blade'
(require '[clojure.string :as str])
(defn SplitStringToList
[input_string]
(map read-string (str/split input_string #" "))
)
(defn MinInSlice
[[start end] widths]
(apply min (drop start (take (+ 1 end) widths)))
// Starting code, fairly difficult to understand what it is doing.
<?
if ((($bo_row['qtyordu'] - $branch_avail) - $hq_avail) == 0) {
$bo_hq_qty = $hq_avail;
$bo_brn_qty = 0;
} elseif ((($bo_row['qtyordu'] - $branch_avail) - $hq_avail) > 0) {
$bo_hq_qty = $hq_avail;
$bo_brn_qty = (($bo_row['qtyordu'] - $branch_avail) - $hq_avail);
} elseif ((($bo_row['qtyordu'] - $branch_avail) - $hq_avail) < 0) {
@ewingd
ewingd / facepalm_for_loop.php
Last active December 21, 2015 21:08
facepalm for loop
<?php
// Before (this was repeated 3 times in one script, copy and pasted exactly...)
for($i=0,$btotal=0,$total=0,$page=1;$lclass=$row['class'],$lwhse=$row['whse'],$row=mysql_fetch_array($res);$i++,$total+=$row['cost'],$btotal+=$row['cost'],$gtotal+=$row['cost']) {
// ...snip.. 35 lines of echo statements dumping HTML
}
// Removing all the unused variables reduced it down to:
for ($i = 0; $row = mysql_fetch_array($res); $i++) {
// Same 35 lines of echo statements dumping HTML