Skip to content

Instantly share code, notes, and snippets.

View dminuoso's full-sized avatar

Victor Nawothnig dminuoso

View GitHub Profile
@dminuoso
dminuoso / Sentinel.hs
Created July 20, 2018 12:28 — forked from borsboom/Sentinel.hs
hedis wrapper for Redis Sentinel support
{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses, NamedFieldPuns,
NoImplicitPrelude, OverloadedStrings, RankNTypes, ScopedTypeVariables, TupleSections,
ConstraintKinds, TemplateHaskell, StandaloneDeriving #-}
{-# OPTIONS_GHC -funbox-strict-fields -Wall -Werror #-}
-- dependencies: hedis retry safe data-default uuid monad-logger basic-prelude lifted-base either
-- | Wrapper for hedis to support redis-sentinel. It is
-- built-atop of, and re-exports most of, the "Database.Redis" module.
--
@dminuoso
dminuoso / foo.js
Last active October 29, 2017 17:27 — forked from anonymous/.js
const toggleClass = (id, toggle) => id === toggle ? 'toggle active' : 'toggle inactive';
const Style = ({ activeFontColor, activeBackgroundColor, fontColor }) => (
<style jsx>
{`
.toggle {
width: 50%;
height: 50px;
border-radius: 100px;
line-height: 50px;
$("#ajax-action2").click( function() {
const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content");
request = $.ajax({
type: "PATCH",
url: "/home/no_js_view_action",
headers: {
'X_CSRF_TOKEN': AUTH_TOKEN,
},
dataType: "json",
data: {
@dminuoso
dminuoso / some.js
Last active June 27, 2017 10:44 — forked from anonymous/some.js
// Arrow function
$("#ajax-action2").click(() => {
const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content");
// const
const request = $.ajax({
type: "PATCH",
url: "/home/no_js_view_action",
headers: {
'X_CSRF_TOKEN': AUTH_TOKEN,
@dminuoso
dminuoso / random.rb
Created June 21, 2017 13:10 — forked from anonymous/random.rb
rand.rb
takeEven = lambda.select do |x|
x if x % 2 == 0
end
@dminuoso
dminuoso / random.rb
Created June 21, 2017 13:10 — forked from anonymous/random.rb
rand.rb
takeEven = lambda.select do |x|
x if x % 2 == 0
end
@dminuoso
dminuoso / random.rb
Created June 21, 2017 13:09 — forked from anonymous/random.rb
fp.rb
[0,1,2,3,4,5,6,7,8,9].select do |x|
x if x%2==0
end
// The call with a callback to self
try {
winfo = windarea.getWindInfo2(LonLat.lat, LonLat.lon, this.time, wante, wpost);
//this.drawWind(ctx, p.x, p.y, winfo);
var MI = GribMgr.WindAtPointInTime(new Date(this.time*1000),LonLat.lat, LonLat.lon,
function(){this.drawWindArea(p, poslimit, windarea, ctx)})
if (MI)
{
winfo = new Wind(MI.Speed, MI.Heading);
this.drawWind(ctx, p.x, p.y, winfo);
- if Rails.env.production?
%script
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-15209814-7', 'auto');
ga('send', 'pageview');
%script
self.num_reserved = order_data.match(/\"ordered\"\:.*\n/)[0].match(/\d+/)[0]