Skip to content

Instantly share code, notes, and snippets.

View hellboy81's full-sized avatar
🌴
On vacation

hellboy81

🌴
On vacation
  • FondsDepot Bank
  • Germany
View GitHub Profile
import Handlers from './handlers'
export default function configureEventSources () {
const eventSource = new EventSource(ApiRoutes.EventSource)
for (const handler of Handlers) {
eventSource.addEventListener(handler.eventType, event => {
handler.handle(event)
})
}
}
@alexeyzimarev
alexeyzimarev / JsonNetRestSharp.cs
Created December 30, 2018 21:08
Using Newtonsoft.Json with RestSharp v106.6
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Serialization;
namespace JsonNetRestSharp
{
class Program
{
static void Main(string[] args)
{
@nickname55
nickname55 / JiraRestClientExample.groovy
Created April 26, 2018 19:41
Groovy HTTP client for JIRA REST API
package pampushko.jira.rest.groovy
/**
* You might need to import JIRA ssl certificate into your jdk/jre cacerts file:
* 1) save JIRA certificate. E.g. in Chrome right click on https icon, click "Certificate information" link.
* In "Details" tab, click "Copy to File..." button.
* 2) in jdk "bin" folder run: "keytool -importcert -keystore ./cacerts -file /file/from/the/step/above/cacert.crt -trustcacerts -alias jira_ca
*/
class JiraRestClientExample {
static void main(String[] args) {
@koxkox
koxkox / OracleDynamicParameters.cs
Created February 27, 2018 06:41 — forked from vijayganeshpk/OracleDynamicParameters.cs
OracleDynamicParameters class for Dapper
using Dapper;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
public class OracleDynamicParameters : Dapper.SqlMapper.IDynamicParameters
{
private static Dictionary<SqlMapper.Identity, Action<IDbCommand, object>> paramReaderCache = new Dictionary<SqlMapper.Identity, Action<IDbCommand, object>>();
@autumnwoodberry
autumnwoodberry / user.js
Last active March 24, 2022 06:49
vuex + vuelidate
import Vue from 'vue'
import { validationMixin } from 'vuelidate'
import { required, minLength } from 'vuelidate/lib/validators'
export default function (store) {
const validator = new Vue({
mixins: [
validationMixin
],
computed: {
@sloanlance
sloanlance / guzzle.md
Created March 2, 2017 18:13
PHP: Guzzle as replacement for direct use of Curl or PECL HTTP modules.

Copied from: https://github.com/IMSGlobal/caliper-php/issues/126#issuecomment-226624750

I've recently learned that Guzzle is a popular HTTP client library for PHP: http://guzzlephp.org/

This package has a lot of nice features, including:

  • Simple interface for building query strings, POST requests, streaming large uploads, streaming large downloads, using HTTP cookies, uploading JSON data, etc...
  • Can send both synchronous and asynchronous requests using the same interface.
  • Uses PSR-7 interfaces for requests, responses, and streams. This allows you
@hoangitk
hoangitk / task-msbuild.js
Created November 18, 2016 07:51
VSCode task with msbuild
{
"version": "0.1.0",
"command": "cmd",
"args": [
"/c"
],
"showOutput": "always",
"echoCommand": true,
"tasks": [
{
@jamesmacwhite
jamesmacwhite / ffmpeg_mkv_mp4_conversion.md
Last active May 5, 2024 15:42
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

<!--
In Vue, we use v-model for all form bindings, while
Knockout maintains separate binding types, such as
textInput, checked, and options. In some cases,
such as for an input of type "range", Knockout
simply doesn't have an equivalent two-way binding
helper and the more verbose value and valueUpdate
must be used.
-->
<div id="app">