Skip to content

Instantly share code, notes, and snippets.

View Nosherwan's full-sized avatar
🏠
Working remotely

Nosh Ghazanfar Nosherwan

🏠
Working remotely
View GitHub Profile
@Nosherwan
Nosherwan / package.json
Created October 23, 2015 09:56
Simple Webpack config for React 0.14.0 App
{
"name": "react-proj",
"version": "1.0.0",
"description": "A base to start a react+flux app",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot --inline"
},
"author": "NoshGhazanfar",
"license": "ISC",
@Nosherwan
Nosherwan / Home.js
Created November 1, 2015 22:24
React Home Component
import React from 'react';
import ArticleStore from '../stores/ArticleStore';
import ArticleList from './articleList';
class Home extends React.Component {
constructor(props) {
super(props);
var params = this.props.params;
this.state = {articles: ArticleStore.getAll()};
}
@Nosherwan
Nosherwan / AuthService.js
Created November 1, 2015 22:27
React AuthService
import dataHelper from './DataHelper';
import LoginActions from '../actions/LoginActionCreators';
let AuthService = {
login: function (email, password) {
dataHelper.fetchPost('session', {email: email, password: password})
.then(resp => {
let {token,expires,user} = resp;
LoginActions.loginUser(token, expires,user);
@Nosherwan
Nosherwan / ArticleStore.js
Last active November 1, 2015 23:18
Flux Article Store ES6 Syntax
import AppDispatcher from '../dispatcher/AppDispatcher';
import {EventEmitter} from 'events';
import AppConstants from '../constants/AppConstants';
let _articles = [];
function _addArticle(article) {
_articles.push(article);
}
module.exports = function (grunt) {
var serveStatic = require('serve-static');
var LIVERELOAD_PORT = 35729; // Default port
require('load-grunt-tasks')(grunt);
grunt.initConfig(
{
clean : { //cleans the dist folder
build: {
src: ['dist/*']
@Nosherwan
Nosherwan / flatten.js
Last active September 18, 2016 09:50
/**
* The following flatten method is added to the Array prototype.
* The method can directly be called on the Array object and will flatten it.
* The contents of this file can be copy pasted into a browser window console and run.
*/
Array.prototype.flatten = function () {
var array = this;
var flatArray = this.flatArray || [];
@Nosherwan
Nosherwan / .vimrc
Created September 20, 2022 22:14 — forked from joegoggins/.vimrc
Mac Vim .vimrc file
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom