Skip to content

Instantly share code, notes, and snippets.

@bezborodow
bezborodow / Matlab RLC Bandpass
Created December 1, 2020 14:25
Matlab RLC Bandpass
fr = @(l, c) 1 / (2 * pi * sqrt(l*c) );
xl = @(l, c) 2 * pi * fr(l, c) * l;
xc = @(l, c) 1 / (2 * pi * fr(l, c) * c);
q = @(l, c, r) r / xl(l, c);
bw = @(l, c, r) fr(l, c) / q(l, c, r);
@bezborodow
bezborodow / Adapter.php
Last active March 23, 2024 04:52
MySQLi to PDO Shim
<?php
namespace MySQLi\PDO\Adapter;
use PDO;
use PDOStatement;
class Connection
{
public $affected_rows;
@bezborodow
bezborodow / Makefile
Last active September 2, 2019 03:58
Laravel Build Makefile
WWW ?= /var/www
WWW_USER ?= apache
WWW_GROUP ?= wheel
js_assets = public/js/app.js
css_assets = public/css/app.css
assets = $(js_assets) $(css_assets)
css_deps = $(shell find resources/assets/sass/ -name '*.css' -o -name '*.scss')
js_deps = $(shell find resources/assets/js/ -name '*.js' -o -name '*.vue')
rsync_src = vendor storage config app public resources bootstrap routes artisan composer.*
<template>
<select ref="select">
<option v-if="!this.value"></option>
</select>
</template>
<script>
export default {
props: ['options', 'url', 'placeholder', 'allow_clear', 'label', 'value'],
@bezborodow
bezborodow / byte_multiples.html
Last active October 7, 2016 04:59
Bytes Multiple Unit Calculator
<!--
Requires Bootstrap and jQuery.
-->
<script type="text/javascript">
$(function() {
$('.calc-input').change(function() {
$('#calc-output').val(parseInt($('#calc-quantity').val()) * parseInt($('#calc-prefix').val()));
}).trigger('change');
});
@bezborodow
bezborodow / past_tense.php
Created October 5, 2016 07:12
Regular Expression to Change Verb to Past Tense
<?php
$verb = 'Suspend'; // becomes Suspended
$verb = 'Shape'; // becomes Shaped
$past = preg_replace('/(\w+?)e?\b/', '$1ed', $verb, 1);
@bezborodow
bezborodow / .bashrc
Last active March 7, 2024 13:36
Damo's UNIX Development Environment Preferences
# Bash prompt with colour-coded exit status
PS1="\e[0;36m\]\h \`if [ \$? = 0 ]; then echo '\e[01;32m\]\w\e[00m\]\$ '; else echo '\e[01;31m\]\w\e[00m\]\$ '; fi\`"
# Or for local machine:
# PS1="\e[0;46m\]\h\e[00m\] \`if [ \$? = 0 ]; then echo '\e[01;32m\]\w\e[00m\]\$ '; else echo '\e[01;31m\]\w\e[00m\]\$ '; fi\`";
# Ctags for Ruby
alias rtags='ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)'
# Ctags for PHP
# https://github.com/shawncplus/phpcomplete.vim/wiki/Patched-ctags