Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mohan Dere mohandere

🎯
Focusing
View GitHub Profile
@mohandere
mohandere / blogFactory.js
Last active Aug 29, 2015
Angular Factory/Service for Interaction with Wordpress Blog
View blogFactory.js
function fzBlogFactory($http, $sce, config) {
function allPosts() {
return httpRequest('posts?filter[category_name]=post');
}
function postByID(id) {
return httpRequest('posts/' + id);
}
function featuredPosts() {
@mohandere
mohandere / app.js
Last active Aug 23, 2016
i18n with polyglot.js and rendr.js
View app.js
var patches = require('./lib/patches')
, BaseApp = require('rendr/shared/app')
, handlebarsHelpers = require('./lib/handlebarsHelpers')
, Polyglot = require('node-polyglot')
, _ = require('underscore');
/**
* setup constants/globals
*/
@mohandere
mohandere / templateManager.js
Created Oct 18, 2016
Template Manager plugin for Loading HBS template files:
View templateManager.js
/*
templateManager - Async Handlebars template loader/cacher.
@author Mohan Dere
@version 1.0
@requires jQuery || zepto, underscore, Handlebars.js
*/
(function() {
@mohandere
mohandere / app.js
Last active May 19, 2017
React-todo
View app.js
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
import { Grid, Row, Col, PageHeader } from 'react-bootstrap';
import './App.css';
import Home from './components/Home';
import About from './components/About';
class App extends Component {
@mohandere
mohandere / FilesLoader-Usage.js
Created Jun 21, 2017
Asynchronous files loading with jquery deferred with callback
View FilesLoader-Usage.js
//Usage
var tplsToLoad = [
'tpl/menu-section',
'tpl/header',
'tpl/footer'
];
window.FilesLoader.load(tplsToLoad,
function () {
@mohandere
mohandere / 0_reuse_code.js
Created Jun 21, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mohandere
mohandere / epic.js
Last active Aug 31, 2017
Writing epics with redux-observable
View epic.js
import * as ajax from '../../utils/ajax';
import 'rxjs/add/operator/catch'
import {
Observable
} from 'rxjs/Observable';
import queryString from 'query-string'
import _ from 'lodash'
import {
PRODUCTS_REQUEST_START,
@mohandere
mohandere / MyModal.js
Last active Oct 12, 2017
Higher Order Component for react-modal to handle modal bottom issue
View MyModal.js
import React from 'react';
import ReactModal from 'react-modal';
import withModal from './withModal';
class MyModal extends React.Component {
constructor(props) {
super(props)
@mohandere
mohandere / accordion.js
Last active Nov 21, 2017
Jquery UI Sortable with Accordion: Save sort order
View accordion.js
scmAcco.accordion({
header: "> div > h3",
collapsible: true,
active: false,
heightStyle: "content",
}).sortable({
update: function(event, ui) {
//On update get new order of elements as an array
var serialized = $(this).sortable("toArray", {
@mohandere
mohandere / App.js
Last active Nov 21, 2017
React js Responsive Gallery with Masonry Layout and Lightbox
View App.js
import React, {
Component
} from 'react';
//Import responsive gallery component
import ResponseiveGallery from './components/ResponsiveGallery';
// Define array of images with thumbnails
const DEFAULT_IMAGES = [{
src: '/images/gallery-1.jpg',
thumbnail: '/images/gallery-1.jpg',
You can’t perform that action at this time.