Skip to content

Instantly share code, notes, and snippets.

Andreas Frömer icanhazstring

Block or report user

Report or block icanhazstring

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@icanhazstring
icanhazstring / delete-merged-branches.sh
Last active Mar 19, 2019
Git delete multiple remote merged branches
View delete-merged-branches.sh
# git branch -r --merged master
## List all remote merged branches (master)
# awk -Forigin/ '/\/PVKZU-/ {print $2}'
## remove origin/ prefix
# tr '\n' ' '
## Replace new line with space (to get one single argument)
# xargs -rt git push origin --delete
@icanhazstring
icanhazstring / dark-theme-loader.js
Last active Feb 15, 2019
Enable slack desktop dark-theme
View dark-theme-loader.js
// First make sure the wrapper app is loaded
document.addEventListener("DOMContentLoaded", function() {
// Then get its webviews
let webviews = document.querySelectorAll(".TeamView webview");
// Fetch our CSS in parallel ahead of time
const cssPath = 'https://raw.githubusercontent.com/Nockiro/slack-black-theme/3ea2efdfb96ccc91549837ab237d57104181bbf8/custom.css';
let cssPromise = fetch(cssPath).then(response => response.text());
@icanhazstring
icanhazstring / .travis.yml
Created Feb 14, 2019
Enable Travis PHP Build on Windows
View .travis.yml
# default os is linux
matrix:
include:
- language: php
php: 7.2
before_script:
- composer install
after_script:
- sh .travis.coverage.sh
@icanhazstring
icanhazstring / composer-windows-vagrant.bat
Last active Jan 24, 2019
IntelliJ/PHPStorm composer remote execution using Vagrant
View composer-windows-vagrant.bat
:: Prerequisties
:: - Git for Windows
:: - Vagrant
"C:\Program Files\Git\bin\sh.exe" -c "vagrant ssh -c 'cd /vagrant && composer %*'"
:: Setting up composer in IDE
:: Settings > Languages & Frameworks > PHP > Composer
:: Insert /path/to/your/composer.bat
@icanhazstring
icanhazstring / Vagrantfile
Created Sep 6, 2017
Simple Vagrantconfig PHP7.1 + composer
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "puphpet/ubuntu1604-x64"
config.vm.provision "shell", inline: <<-SHELL
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php7.1 php7.1-xml php7.1-mbstring php7.1-zip php7.1-curl php7.1-xdebug composer
# Switch to /vagrant and install packages
cd /vagrant && composer install
View array_iteration_thoughts.md

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

View gist:d2c6f095712af45ba44ac530747cf869
permutate: function(input, current) {
// Input
// [
// {a: [1]},
// {b: [2,3]},
// {c: [3,4]}
// ]
// Result
// [
@icanhazstring
icanhazstring / test.php
Created Mar 10, 2016
AOP Method Depedency Binding
View test.php
/**
* @dependency($awesomeService => \Common\Service\AwesomeService)
* @dependency($megaService => \Common\Service\MegaService)
*/
public function getFubar($id, $dependecies)
{
$awesomeService = $dependencies->awesomeService;
$megaService = $dependencies->megaService;
$awesomeService->getData($id);
View gist:71d974a58d2f35e8abc8
## install
yum install zeromq-devel
## install zmq.so
cd ~
git clone git://github.com/mkoppanen/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install
You can’t perform that action at this time.