Skip to content

Instantly share code, notes, and snippets.

@ValentinBlokhin
ValentinBlokhin / rc-producer.yml
Created August 2, 2017 10:32
Gives opportunity to easily start debug ava tests using chrome in webstorm. https://github.com/avajs/ava/blob/master/docs/recipes/debugging-with-chrome-devtools.md
# The list or single options object
# The applicable file patterns. Required. Single (not list) pattern maybe specified.
files: ["**/Tests/**/*", "**/*.spec.*", "**/*.test.*", "!**/node_modules/**/*"]
# The script to run. Defaults to current file.
script: "/usr/local/bin/inspect"
# The script args. Next macros are supported:
# ${file} — current file,
# ${fileNameWithoutExt} — current file name without extension,
@LukaszWiktor
LukaszWiktor / postgres-remove-field-from-json.sql
Created November 25, 2016 16:20
PostrgreSQL - remove a nested JSON field if it's null
-- before: data_json = {object: {id: 123, result: null}}
-- after: data_json = {object: {id: 123}}
UPDATE events
SET data_json = data_json::jsonb #- '{object,result}'
WHERE json_typeof(data_json->'object'->'result') = 'null';
import rx.Observable;
import rx.schedulers.Schedulers;
import java.util.List;
public class SwitchRxSchedulers {
public static void main(String[] args) throws InterruptedException {
final Object monitor = new Object();
@guumaster
guumaster / 00-README.md
Last active January 23, 2023 15:48
How to upload a file with $.ajax to AWS S3 with a pre-signed url

Upload a file with $.ajax to AWS S3 with a pre-signed url

When you read about how to create and consume a pre-signed url on this guide, everything is really easy. You get your Postman and it works like a charm in the first run.

Then you open your browser, try your usual $.ajax() and send your PUT operation, and you hit the cold iced wall of AWS error message, a simple <Code>SignatureDoesNotMatch</Code> that will steal hours from your productivity.

So here I come to save you and give you a free working example of how to upload a file directly to AWS S3 from your browser. You are wellcome :).

@jewelsea
jewelsea / WebViewCaptureDemo.java
Created May 23, 2013 05:38
Captures web pages to image files using JavaFX WebView and ImageIO
import javafx.animation.PauseTransition;
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.embed.swing.SwingFXUtils;
import javafx.event.*;
import javafx.geometry.Bounds;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;