Skip to content

Instantly share code, notes, and snippets.

package com.packtpub.learnvaadin.twaattin.service;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerContext;
import org.quartz.SchedulerException;
import com.packtpub.learnvaadin.twaattin.ui.TimelineWindow;
@nfrankel
nfrankel / gist:2874011
Created June 5, 2012 09:43
Batch create users in Ubuntu
declare -A students
students[foo]=abricot
students[bar]=brique
students[baz]=botte
for k in "${!students[@]}"
do
adduser "$k"
echo "$k":${students["$k"]} | /usr/sbin/chpasswd
done
@nfrankel
nfrankel / gist:5780044
Last active December 18, 2015 11:59
MongoDB aggregation framework example
db.grades.aggregate([
{$unwind: "$aaa"},
{$match: {$or: [{"aaa.bbb": "gloubi"}, {"aaa.bbb": "boulga"}]}},
{$group: { _id: {ccc: "$ccc_id", ddd: "$ddd_id"}, avg: {$avg: "$aaa.eee"}}},
{$group: {_id: "$_id.ccc", avg: {$avg: "$fff"}}},
{$sort: {ggg : -1}},
{$limit: 1}
])
@nfrankel
nfrankel / gist:2dad7ce8430ef3f9244f
Created February 1, 2016 16:35
Incompetent spammer comment
{
{I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any
interesting article like yours. {It’s|It is} pretty worth enough for me.
{In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web
owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a
lot more} useful than ever before.|
I {couldn’t|could not} {resist|refrain from} commenting.
{Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I’ll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed}
as I {can not|can’t} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter}
@Configuration
open class AppConfiguration {
// ... Abridged for readability's sake
@Bean
open fun vaadinServlet() = CustomVaadinServlet{ event: SessionInitEvent ->
event.session.addBootstrapListener(object : BootstrapListener {
override fun modifyBootstrapFragment(response: BootstrapFragmentResponse) {
// NOP, this is for portlets etc
JavaScript.eval("document.querySelector('html').setAttribute('lang', 'fr')")
image: ruby:2.1 # the script will run in Ruby 2.1 using the Docker image ruby:2.1
pages: # the build job must be named pages
script:
- gem install jekyll # we install jekyll
- gem install jekyll-asciidoc
- jekyll build -d public/ # we tell jekyll to build the site for us
artifacts:
paths:

layout: post type: posts title: "Encapsulation: I don't think it means what you think it means" tags: [design, object-oriented-programming] categories: Development picture: src: /assets/resources/encapsulation-dont-think-means-think-means/inigomontoya.jpg height: 453 width: 525

import org.springframework.boot.json.BasicJsonParser;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@nfrankel
nfrankel / post-commit
Last active November 13, 2016 18:04
Git post commit hook to generate site from README.doc
#/bin/sh
git checkout gh-pages
git checkout master -- README.adoc
asciidoctor README.adoc
mv README.html index.html
git add index.html
git commit -m "Update site with documentation"
git push origin HEAD --force
git checkout master