Skip to content

Instantly share code, notes, and snippets.

View rocky-jaiswal's full-sized avatar

Rocky Jaiswal rocky-jaiswal

View GitHub Profile
@rocky-jaiswal
rocky-jaiswal / Workflow.java
Created January 24, 2024 09:40
Sample workflow using vavr
package dev.rockyj;
import io.vavr.API;
import io.vavr.control.Either;
import static io.vavr.API.*;
enum PossibleWorkflowStates {
INIT,
IN_PROGRESS,
hr {
border-top: 2px solid #045295 !important;
}
.homepage-blocks {
display: none;
}
#app-cta {
display: none;
const isPresent = complement(isNil)
const isAllowed = (val) => ['foo', 'bar'].includes(val)
const hasChildWithProp = propSatisfies(isAllowed, 'x')
const validResponseInEnum = allPass([isPresent, isAllowed])
const validResponseWithProp = allPass([isPresent, hasChildWithProp])
console.log(validResponseInEnum(null))
console.log(validResponseInEnum('foo'))
console.log(validResponseWithProp({y: 'foo'}))
@rocky-jaiswal
rocky-jaiswal / mejs_playbackrate_plugin
Last active June 10, 2019 18:52
Media Element JS plugin to modify video playback speed.
//Copy this plugin and add 'fasterslower' to the features array. Also write the CSS :)
(function($) {
$.extend(mejs.MepDefaults, {
fasterslowerText: 'Faster/Slower'
});
$.extend(MediaElementPlayer.prototype, {
buildfasterslower: function(player, controls, layers, media) {
@rocky-jaiswal
rocky-jaiswal / prod_cons_actors.rb
Created June 24, 2013 04:56
Producer Consumer with Actors
require 'celluloid/autostart'
class Cook
include Celluloid
def produce(manager)
manager.async.inform("produced")
end
end
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fluentd-es
namespace: kube-system
labels:
k8s-addon: logging-elasticsearch.addons.k8s.io
k8s-app: fluentd-es
kubernetes.io/cluster-service: "true"
version: v1.22
@rocky-jaiswal
rocky-jaiswal / Gruntfile2.js
Created October 24, 2013 10:04
Gruntfile2
// Generated on 2013-10-24 using generator-angular 0.5.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
var mountFolder = function (connect, dir) {
@rocky-jaiswal
rocky-jaiswal / gist:7113077
Created October 23, 2013 05:37
New GruntFile
// Generated on 2013-10-22 using generator-angular 0.5.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
@rocky-jaiswal
rocky-jaiswal / Gemfile.lock
Created December 21, 2015 14:45
Gemfile.lock for a new Rails 5 (API only) project
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0.beta1)
actionpack (= 5.0.0.beta1)
celluloid (~> 0.17.2)
coffee-rails (~> 4.1.0)
em-hiredis (~> 0.3.0)
faye-websocket (~> 0.10.0)
redis (~> 3.0)
@rocky-jaiswal
rocky-jaiswal / prod_cons.rb
Created June 24, 2013 04:54
Producer Consumer problem with locks
class Cook
def produce
"item"
end
end
class Consumer
def consume(item)
#do something with item
end