Skip to content

Instantly share code, notes, and snippets.

View rase-'s full-sized avatar

Tony Kovanen rase-

  • Helsinki, Finland
View GitHub Profile
var io = require('socket.io')();
io.on('connection', function(socket){console.log('connected');});
io.listen(3000);
@rase-
rase- / After
Last active August 29, 2015 14:01
Grayscale Tiled Gallery items shouldn't have Carousel information
<div data-carousel-extra='{"blog_id":1,"permalink":"http:\/\/tonykova.users.cs.helsinki.fi\/test-wp\/2014\/04\/23\/test-gallery\/","likes_blog_id":67087184}' class="tiled-gallery type-rectangular tiled-gallery-unresized" data-original-width="474">
<div class="gallery-row" data-original-width="469" data-original-height="210" style="width: 469px; height: 206px;">
<div data-original-width="313" data-original-height="210" class="gallery-group images-1" style="width: 313px; height: 210px;">
<div class="tiled-gallery-item tiled-gallery-item-large">
<a href="http://i0.wp.com/tonykova.users.cs.helsinki.fi/test-wp/wp-content/uploads/2014/04/good_times2.jpg">
<img data-original-width="309" data-original-height="206" data-attachment-id="186" data-orig-file="http://tonykova.users.cs.helsinki.fi/test-wp/wp-content/uploads/2014/04/good_times2.jpg" data-orig-size="603,402" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&q
@rase-
rase- / benchmark.php
Last active August 29, 2015 14:01
Benchmark
public function gallery_shortcode( $val, $atts ) {
$start_time = microtime( true );
if ( ! empty( $val ) ) // something else is overriding post_gallery, like a custom VIP shortcode
return $val;
global $post;
$this->set_atts( $atts );
$attachments = $this->get_attachments();
@rase-
rase- / MissileRadius
Last active August 29, 2015 13:57
Missile radius computation and visualization. What if Pyonyang launched missiles?
% Starting position
start_lat = 39.0291382;
start_lon = 125.7421118;
dist = 10000; % in km
arclen = distdim(dist, 'km', 'deg', 'earth');
% Open KML file
fh = fopen('viz.kml', 'w+');
fprintf(fh, '<?xml version="1.0" encoding="UTF-8"?>\n');
fprintf(fh, '<kml xmlns="http://www.opengis.net/kml/2.2">\n');
@rase-
rase- / Ruma.java
Created April 19, 2012 19:29
RUma
@RequestMapping(value = "reference/bibtex", method = RequestMethod.POST)
public String generateBibtex(@Valid @ModelAttribute FileForm fileForm, BindingResult result, Model model, HttpServletResponse response) throws IOException {
if (result.hasErrors()) {
return "bibtex";
}
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + fileForm.getFilename() + ".bib");
InputStream is = new StringBufferInputStream(bibtexService.generateBibtex());
IOUtils.copy(is, response.getOutputStream());
response.flushBuffer();