Skip to content

Instantly share code, notes, and snippets.

View fedotxxl's full-sized avatar

Fedor Belov fedotxxl

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
var url = "https://twitter.com/intent/tweet?" + $.param({
@fedotxxl
fedotxxl / wav.ga.js
Created March 5, 2015 08:51
ga util functions
(function() {
window._gaq = window._gaq || [];
var ga = wav.ga;
var eventsPercentage = wav.$config.data("ga-events-percentage");
ga.getCurrentPageCategory = function() {
return "page_" + wav.getCurrentPage();
};
ga.isLoaded = function() {
#!/bin/sh
processName="vs-site"
logsPath="/home/fbelov"
delay=15
logsFullPath=${logsPath}/${processName}-jstack
mkdir -p $logsFullPath
while true
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExceptionStatus {
OPENED("open"), FIXED("fixed"), IGNORE("ignore"), LATER("later");
private String id;
ExceptionStatus(String id) {
Client client = ClientBuilder.newBuilder()
.register(MultiPartFeature.class)
.build();
WebTarget target = client.target(config.getFilePath(id));
StreamDataBodyPart filePart = new StreamDataBodyPart("file", new FileInputStream(archiveFiles(files)), "a.zip");
MultiPart multipart = new FormDataMultiPart().bodyPart(filePart);
response = target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(multipart, multipart.getMediaType()));
JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider();
ObjectMapper objectMapper = new ObjectMapper()
.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
jacksonJsonProvider.setMapper(objectMapper);
client = ClientBuilder.newClient().register(jacksonJsonProvider);
@JsonDeserialize(converter=MyClassSanitizer.class) // invoked after class is fully deserialized
public class MyClass {
public String field1;
}
import com.fasterxml.jackson.databind.util.StdConverter;
public class MyClassSanitizer extends StdConverter<MyClass,MyClass> {
@Override
public MyClass convert(MyClass var1) {
var.field1 = munge(var.field1);
@fedotxxl
fedotxxl / gulpfile.js
Last active August 29, 2015 14:25
job.gulp.useref.source-maps-support.js
var gulp = require("gulp");
var del = require("del");
var path = require("path");
var lazypipe = require("lazypipe");
var $ = require("gulp-load-plugins")({lazy: false});
var paths = {
src: "./src",
assets: {
src: "./assets",
return dvds
.request()
.accept(MediaType.APPLICATION_JSON)
.get(new GenericType<List<ConsumedDvd>>(){})
package com.devadmin.util.metrics
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.ImportResource
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.transaction.TransactionConfiguration
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
@Configuration