Skip to content

Instantly share code, notes, and snippets.

View themarcba's full-sized avatar

Marc Backes themarcba

View GitHub Profile
.transparent {
zoom: 1;
filter: alpha(opacity=70);
opacity: 0.7;
}
@themarcba
themarcba / http.sh
Last active September 8, 2015 23:10
ifconfig en0 | grep inet
if [ -z "$1" ]; then
python -m SimpleHTTPServer 8080
else
python -m SimpleHTTPServer $1
fi
if [ "$1" == "develop" ] || [ "$1" == "d" ] || [ -z "$1" ]; then
echo "Pushing to develop..."
git push code develop
elif [ "$1" == "master" ] || [ "$1" == "m" ]; then
echo "Pushing to master..."
git push code master
else
echo "Push feature/$1..."
git push code "feature/$1"
fi
if [ "$1" == "develop" ] || [ "$1" == "d" ] || [ -z "$1" ]; then
echo "Pushing to develop..."
git pull code develop
elif [ "$1" == "master" ] || [ "$1" == "m" ]; then
echo "Pushing to master..."
git pull code master
else
echo "Push feature/$1..."
git pull code "feature/$1"
fi
git add -A .
if [ -z "$0" ]; then
git commit -am "- undefined -"
else
git commit -am "$*"
fi
// Transforms a string to either upper or lowercase, depending which is dominant
// code => code
// coDe => code
// CoDE => CODE
// etc.
const transform = input => {
const lower = [...input].reduce((count, char) => {
return char == char.toLowerCase() ? count + 1 : count
}, 0)
return lower / input.length >= .5 ? input.toLowerCase() : input.toUpperCase()
window.App.startLocalMedia(video, screencapture, audioonly, receiveonly, null, null).then(
function(o) {
if (!receiveonly) {
fm.liveswitch.Log.info('Started local media.')
}
fm.liveswitch.Log.info('Registering...')
window.App.joinAsync(_this.incomingMessage, _this.peerLeft, _this.peerJoined, _this.clientRegistered).then(
function(o) {
const timedResolve = name => {
return new Promise(resolve =>
setTimeout(() => {
console.log(name)
resolve()
}, 500 * Math.random()),
)
}
Promise.all([
@themarcba
themarcba / vdom-finished.html
Last active April 20, 2024 03:37
Vue.js-like Virtual DOM
<div id="app"></div>
<script>
// Create virtual node
function h(tag, props, children) {
// Return the virtual node
return {
tag,
props,
children,
}
@themarcba
themarcba / vuejs-like-dependency.html
Last active February 5, 2024 11:51
Vue.js-like Reactive Dependency
<script>
let activeEffect
class Dep {
// Initialize the value of the reactive dependency
constructor(value) {
this._value = value
this.subscribers = new Set()
}