Skip to content

Instantly share code, notes, and snippets.

View pyadav's full-sized avatar
🐢
learning new stuff

Praveen Yadav pyadav

🐢
learning new stuff
View GitHub Profile
@pyadav
pyadav / jquery.css3caching.js
Last active August 29, 2015 14:27 — forked from mdellanoce/jquery.css3caching.js
CSS3 caching
(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
@pyadav
pyadav / app.js
Last active August 29, 2015 14:27 — forked from mdellanoce/app.js
Auto-optimization with Express and RequireJS
var express = require('express'),
requirejs = require('requirejs'),
app = module.exports = express.createServer();
app.configure('development', function(){
// Use development version of static files
app.use(express.static(__dirname + '/public'));
});
app.configure('production', function(){
@pyadav
pyadav / BaseClass.jsx
Last active August 29, 2015 14:27 — forked from tmbtech/BaseClass.jsx
ES7 Decorator Test
import React from "react";
import {ContextTypes, DefaultProps, PropTypes} from "./Decorators";
// this will throw a warning.
@PropTypes({name: React.PropTypes.func})
@DefaultProps({name: "robbie"})
class BaseClass extends React.Component {
render() {
return (
<div className="base-class-example">
@pyadav
pyadav / some-component.js
Last active November 28, 2015 01:00 — forked from oriSomething/some-component.js
Reflux + React + ES7 decorators
import React, { Component } from 'react';
import storeDecorator from './store-decorator';
import someStore, { SOME_STORE_SYMBOL } from './some-reflux-store';
@storeDecorator(someStore)
class SomeComponent extends Component {
render() {
return (
<div>
{this.state[SOME_STORE_SYMBOL].someProperty}
@pyadav
pyadav / App-react-flux-async-dependent-store-init.js
Last active August 29, 2015 14:27 — forked from MadLittleMods/App-react-flux-async-dependent-store-init.js
Flux: Initialize from asynchronous storage with interdependent stores - `waitFor` async - The real solution to this problem would be to create a DAO/service to feed data into the store via actions.
import React from 'react';
import SomeStore from '../stores/SomeStore';
import AppActions from '../actions/AppActions';
function gatherSomeStoreState(props, state) {
return {
myRandomNumber: SomeStore.getRandomNumber()
};
}
@pyadav
pyadav / ReactJS-Cookie.js
Last active August 29, 2015 14:27 — forked from simondavies/ReactJS-Cookie.js
A React JS & ES2015 Cookies pop up component and example files
@pyadav
pyadav / deployUser.md
Last active August 29, 2015 14:27 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@pyadav
pyadav / install-redis.sh
Last active September 4, 2015 07:32 — forked from dstroot/install-redis.sh
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@pyadav
pyadav / Readme.md
Created December 27, 2015 15:32 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@pyadav
pyadav / elasticsearch-cheatsheet.txt
Created March 11, 2016 05:22 — forked from stephen-puiszis/elasticsearch-cheatsheet.txt
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}