Instantly share code, notes, and snippets.

View gist:d941b0fdac1e616afe5b17922db4447a
const sl = (array, extra) => {
extra = extra || 1;
console.log('-'.repeat(extra),array[0].title, array[1].title, array[2].title, array[3].title, array[4].title, array[5].title, array[6].title);
return array.length === 7 ? "simple slicing done" : sl(array.slice(1), extra=extra+1);
};
const shuffleArray = arr => (
arr
.map(a => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map(a => a[1])
View .bashrc
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (*\([^)]*\))*/\1/'
}
function markup_git_branch {
if [[ -n $@ ]]; then
if [[ -z $(git status --porcelain 2> /dev/null | tail -n1) ]]; then
echo -e " \001\033[32m\002($@)\001\033[0m\002"
else
View post-receive
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
echo 'Changes pushed master.'
fi
View Onename.com
Verifying that +santeriv is my blockchain ID. https://onename.com/santeriv
View affirmation
I, Santeri Vesalainen, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Wed Aug 13 2014 22:59:34 GMT+0300 (Suomen kesäaika)
View console_fix.js
/*
Story goes like this :
4th of kind-a-thing siblings finds last thing's children 4th child and removes it and then asks her parent to make her a sibling
*/
$("#section-5").siblings("table:nth-of-type(4)").find("tr").last().children().remove('td:nth-of-type(4)').parent().prepend('<td />')
View VaadinChildrenTraverse.java
/**
* A Vaadin helper utility for getting children of Component By.type
*
* @param rootComponent - component where to start
* @param criteriaType
* @return List of components that match type
*/
public static List<Component> getChildrenByClass(HasComponents rootComponent, final Class<?> criteriaType ) {
return getChildren(rootComponent,By.type(criteriaType));
}
View morsecodes.json
[
[ "0", "0", "-----" ],
[ "1", "1", ".----" ],
[ "2", "2", "..---" ],
[ "3", "3", "...--" ],
[ "4", "4", "....-" ],
[ "5", "5", "....." ],
[ "6", "6", "-...." ],
[ "7", "7", "--..." ],
[ "8", "8", "---.." ],
View orionhub_sites_start.sh
#!/bin/bash
set +v
# set your loginname
# loginname="santeriv"
# set your passwordfile containing the password
# passwordfile="orionpass"
cookiefile="orioncookie.txt"
function curl_start_site() {
curl_start_site_cmd="curl 'https://orionhub.org/site/$1' -X PUT -H 'Cookie: $sessioncookie;' --data-binary '{\"HostingStatus\":{\"Status\":\"started\"}}' --compressed"