Skip to content

Instantly share code, notes, and snippets.

View krasnobaev's full-sized avatar
👨‍🔬

Aleksey Krasnobaev krasnobaev

👨‍🔬
View GitHub Profile
@krasnobaev
krasnobaev / Dialog.fragment.xml
Last active May 19, 2016 18:53
sublime ui5 snippets
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core"
>
<SelectDialog
title="Dialog Title"
noDataText="Model not loaded"
search="handleSearch"
liveChange="handleSearch"
confirm="handleDialogApply"
// Where you create your model
var oModel = new CustomModel();
sap.ui.getCore().setModel(oModel);
// To access the model from anywhere
var oModel = sap.ui.getCore().getModel();
$ shopt -s extglob
$ echo images/*
images/004.bmp images/033.jpg images/1276338351183.jpg images/2252.png
$ echo images/!(*.jpg)
images/004.bmp images/2252.png
# prepare to hold your colour
cd /usr/local/src/linux
cp /boot/config-$(uname -r) .config && make oldconfig
# enable CAIAQ module (CONFIG_SND_USB_CAIAQ=m)
# other recommended options:
# CONFIG_SND_DEBUG=y
# CONFIG_SND_DEBUG_VERBOSE=y
# CONFIG_SND_VERBOSE_PRINTK=y
make xconfig
@krasnobaev
krasnobaev / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@krasnobaev
krasnobaev / Handsontable
Created June 30, 2015 11:32
JavaScript
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<link href="handsontable.full.css" rel="stylesheet">
<script src="handsontable.full.js"></script>
// convert tabs to 4 spaces
find . -type f -exec sed -i 's/[ \t]*$//' {} \;
// remove trailing spaces
find . -type f -exec sed -i 's/[ \t]*$//' {} \;
// add new line at the end of file
find . -type f -exec sed -i -e '$a\' {} \;
// convert CRLF to LF
@krasnobaev
krasnobaev / create simple table
Created June 23, 2015 14:09
JavaScript snippets
oTable = document.createElement('table');
oTable.className = 'htCore';
oTbody = document.createElement('tbody');
oTr = document.createElement('oTr');
oTd = document.createElement('oTd');
oTd.appendChild(document.createTextNode('Text'));
oTr.appendChild(oTd);
oTbody.appendChild(oTr);
oTable.appendChild(oTbody);
#!/bin/bash
USERNAME=stub
apt-get -y update
apt-get -y upgrade
apt-get -y dist-upgrade
DEBIAN_FRONTEND=noninteractive apt-get -y install git docker.io mailutils pwgen
apt-get -y autoremove
apt-get -y autoclean
@krasnobaev
krasnobaev / basics
Created October 17, 2014 22:32
R handies
data[47]
table(is.na(data))
mean(data, na.rm=TRUE)
mean(data.R[which(data > 31 & data > 90)])
mean(data[data == 6])
max(data[data == 5], na.rm=TRUE)
by(iris$Sepal.Length, iris$Species == "virginica", mean)[2]
apply(iris[, 1:4], 2, mean)
with(mtcars, tapply(mpg, cyl, mean))