Skip to content

Instantly share code, notes, and snippets.

Ashish Rawat eashish93

Block or report user

Report or block eashish93

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eashish93
eashish93 / SongsListContainer.js
Last active Sep 14, 2016
React separating presentation and logic (smart-dumb component)
View SongsListContainer.js
import React, { Component } from 'react';
import Request from 'superagent';
// Logic (Smart)
class SongsListContainer extends Component {
constructor(props) {
super(props);
this.state = {meta: []}
}
componentDidMount() {
@eashish93
eashish93 / ghostpaginate.md
Last active Jan 11, 2017
Ghost numbered pagination
View ghostpaginate.md

Hye, this is custom numbered pagination with first, next and prev links. Also the user can limit the pagination numbers. Just include this code in pagination.hbs file inside ghost theme partials directory. Any improvements are always welcome.

{{!-- custom pagination file --}}

<nav class="pagination" role="navigation">
    {{#if prev}}
    <a class="prev" href="{{page_url prev}}">&larr; Prev</a>
@eashish93
eashish93 / googledrive.py
Created Feb 23, 2017 — forked from remitamine/googledrive.py
youtube-dl extractor for Google Drive
View googledrive.py
from .common import InfoExtractor
from ..utils import RegexNotFoundError
class GoogleDriveIE(InfoExtractor):
_VALID_URL = r'(?:https?://)?(?:video\.google\.com/get_player\?.*?docid=|(?:docs|drive)\.google\.com/(?:uc\?.*?id=|file/d/))(?P<id>.+?)(?:&|/|$)'
_formats = {
'5': {'ext': 'flv'},
'6': {'ext': 'flv'},
'13': {'ext': '3gp'},
'17': {'ext': '3gp'},
View express-seed.js
const
express = require('express'),
logger = require('morgan'),
path = require('path'),
bodyParser = require('body-parser'),
serveStatic = express.static,
MongoClient = require('mongodb').MongoClient,
io = require('socket.io'),
http = require('http');
View bash scripting cheatsheet.md
@eashish93
eashish93 / material_colors.js
Created Sep 29, 2017
Material Colors in JS (For Use in JS based CSS)
View material_colors.js
// This version is specially built for used in css-in-js solution.
// You can specifically import single colors to take advantage of webpack. For eg: import {red_50} from 'material_colors'
// This one consist of flat naming instead of this json based : https://gist.github.com/kawanet/a880c83f06d6baf742e45ac9ac52af96
module.exports = {
// red
'red_50': '#ffebee',
'red_100': '#ffcdd2',
'red_200': '#ef9a9a',
'red_300': '#e57373',
@eashish93
eashish93 / deploy-node.sh
Last active Nov 17, 2017
Deploy Script for My Node.JS app for zero-downtime (single server - no revert - only latest commit)
View deploy-node.sh
#!/bin/bash
## SEE: http://pm2.keymetrics.io/docs/tutorials/capistrano-like-deployments
# 0. Folder Structure
# -> /var/www/project_root
# -> source
# -> current -> symlink to latest release
# -> versions
# -> sha-of-commit
# -> logs
@eashish93
eashish93 / treeview.js
Created Jan 25, 2018
Simplest tree view rendering in react
View treeview.js
import React from 'react';
function shortId() {
// Taken from stackoverflow. I Forget the reference.
// I generate the UID from two parts here
// to ensure the random number provide enough bits.
var firstPart = (Math.random() * 46656) | 0;
var secondPart = (Math.random() * 46656) | 0;
firstPart = ("000" + firstPart.toString(36)).slice(-3);
secondPart = ("000" + secondPart.toString(36)).slice(-3);
@eashish93
eashish93 / lang.js
Created Feb 3, 2018
Language codes
View lang.js
const langCodes = [
{name: 'Africans', code: 'afr'},
{name: 'Arabians', code: 'abr'},
{name: 'Chinese', code: 'chi_sim'},
{name: 'Danish', code: 'dan'},
{name: 'Dutch', code: 'nld'},
{name: 'English', code: 'eng'},
{name: 'Finish', code: 'fin'},
{name: 'French', code: 'fra'},
{name: 'Greek', code: 'ell'},
You can’t perform that action at this time.