Skip to content

Instantly share code, notes, and snippets.

View gtarsia's full-sized avatar
🏠
Working from home

hello there gtarsia

🏠
Working from home
View GitHub Profile
@gtarsia
gtarsia / gist:f139cb4e452d9d12b8f5
Last active August 29, 2015 14:18
Hide reddit comments by click the side of the comment
function hide(obj) {
$(obj)
.children('.entry').first()
.children('.tagline').first()
.children('.expand').first()
.click();
}
var shouldClick = true;
var preventClickEvent = false;
@gtarsia
gtarsia / tamper-mantis.js
Last active August 29, 2015 14:27
A tampermonkey script to be able to track multiple hours at once in mantis.
// ==UserScript==
// @name Mantis ajax
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match http://mantis.virtualmindsoftware.com/view.php?id=15640#timerecord
// ==/UserScript==
/* To track hours, you do this:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
public static class StreamExtensions
{
public static IEnumerable<TResult> ReadJson<TResult>(this Stream stream)
{
var serializer = new JsonSerializer();
@gtarsia
gtarsia / .1_webpacker_coffee2_vue_jsx.md
Last active December 6, 2021 16:38
(rails + webpacker + coffeescript 2 + vue + vuex + jsx) from an existing rails project, with proper structure

Caveats

Remember that using vue jsx has some caveats. Most importantly that most vue builtin directives are not supported (for example, v-for, v-model, etc.), expect for v-show. Some of them can be implemented manually, but v-model for example is kind of a pain in the ass.
https://vuejs.org/v2/guide/render-function.html#Replacing-Template-Features-with-Plain-JavaScript
https://github.com/vuejs/babel-plugin-transform-vue-jsx#vue-directives
There's this though:
https://github.com/nickmessing/babel-plugin-jsx-v-model

Also the sourcemap result is kind of crappy, things like @ are not mapped correctly, I resorted to just using 'eval' as webpack config.devtool, it's good enough for what I'm doing.

Instructions