Skip to content

Instantly share code, notes, and snippets.

View milankorsos's full-sized avatar

Milan Korsos milankorsos

View GitHub Profile
@milankorsos
milankorsos / redux-actions.ts
Last active September 26, 2024 00:51
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@milankorsos
milankorsos / debug.js
Created November 24, 2011 16:05
define cookie controlled custom outputs for your modules
//Use $.cookie('quickbrowse-debug', true, {expires: 7, path: '/'}) to set.
// ... and $.cookie('quickbrowse-debug', null) to delete.
var qbConsole;
if(!$.cookie('quickbrowse-debug')) {
qbConsole = {};
qbConsole.log = function(){};
} else {
qbConsole = console;
}
@milankorsos
milankorsos / html
Created November 1, 2011 03:09
underscore templates
<script type="text/template" id="something-tmpl">
<% for (var index = 0; index < items.length; index++) { %>
<% var item = items[index]; %>
<p><strong><%= item.username %></strong></p>
<% if (item.age) { %> <p>Age: <%= item.age %></p> <% } %>
<% if (item.sex) { %> <p>Sex: <%= item.sex %></p> <% } %>
<% if (item.location) { %> <p>Location: <%= item.location %></p> <% } %>
<% } %>