Skip to content

Instantly share code, notes, and snippets.

View aolshevskiy's full-sized avatar
👽

Artyom Olshevskiy aolshevskiy

👽
View GitHub Profile
@aolshevskiy
aolshevskiy / inputrc
Created June 17, 2017 00:40
Arch Linux /etc/inputrc
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
$if mode=emacs
@aolshevskiy
aolshevskiy / script.js
Last active August 29, 2015 14:19
parse trick
testCtrl.$inject = ['$scope'];
function testCtrl($scope) {
$scope.foo = function() {
console.log(arguments);
}
}
testDirective.$inject = ['$parse'];
function testDirective($parse) {
var directive = {
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Хабрахабр / Тематические хабы / Захабренные</title>
<link>http://habrahabr.ru/rss/hubs/</link>
<description><![CDATA[Захабренные посты из тематических хабов на Хабрахабре]]></description>
<language>ru</language>
<managingEditor>editor@habrahabr.ru</managingEditor>
<generator>habrahabr.ru</generator>
<pubDate>Mon, 21 May 2012 21:23:07 GMT</pubDate>
#!/bin/bash
function filter_ignored_branches() {
local branches=$1
local ignored=$2
local result=""
for branch in $branches; do
if echo $ignored | grep -v $branch > /dev/null ; then
if [ "$INVERT" != "true" ]; then
result="$result $branch"
fi
#!/bin/bash
set -e
git pull origin master
BRANCHES=""
for branch in $(git branch -r); do
if git log ${branch}^..${branch} | grep "$1" > /dev/null ; then
branch=$(echo $branch | sed s/.*\\///)
BRANCHES="$BRANCHES $branch"
fi
done
@aolshevskiy
aolshevskiy / script.js
Created January 21, 2012 15:42
NodeJS Hello World Http Server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
@aolshevskiy
aolshevskiy / build.gradle
Created January 21, 2012 15:35
Hello World Netty Http Server
apply plugin: "java"
apply plugin: "eclipse"
repositories {
mavenCentral()
}
dependencies {
compile (
"org.jboss.netty:netty:latest.integration",
(function() {
try {
prettyPrint();
} catch(e) {
var scriptId = 'prettyPrinter';
if (document.getElementById(scriptId) === null) {
var elem = document.createElement('SCRIPT');
elem.id = scriptId;
elem.onload = function() {
prettyPrint();
@aolshevskiy
aolshevskiy / build.gradle
Created January 16, 2012 03:14
Multiple webapp resource dirs with Gradle-embed Jetty
import org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext
apply plugin: "jetty"
def newResourceCollection(File... resources) {
shell = new GroovyShell(JettyPluginWebAppContext.class.classLoader)
shell.setProperty("resources", resources as String[])
return shell.evaluate(file("resource_collection.groovy"))
}
import com.google.inject.*;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import com.google.inject.servlet.SessionScoped;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
/**