Skip to content

Instantly share code, notes, and snippets.

View nix1947's full-sized avatar
:octocat:
Pro

Manoj Gautam nix1947

:octocat:
Pro
View GitHub Profile
@nix1947
nix1947 / gulpfile.js
Created December 9, 2016 05:16
gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
jade = require('gulp-jade'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'), // Livereload plugin needed: https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
tinylr = require('tiny-lr'),
express = require('express'),
@nix1947
nix1947 / _banner.html
Created December 9, 2016 10:11
bootstrap banner
<style>
/*
Fade content bs-carousel with hero headers
Code snippet by maridlcrmn (Follow me on Twitter @maridlcrmn) for Bootsnipp.com
Image credits: unsplash.com
*/
/********************************/
/* Fade Bs-carousel */
@nix1947
nix1947 / banner.scss
Last active December 12, 2016 12:36
Create black transparent overlay over background image in banner
.jumbotron{
//background-image: url("http://www168.lunapic.com/editor/images/slide21.jpg");
background-image: url('/static/images/banner.jpg');
background-size: cover;
box-shadow: inset 0 0 0 1000px rgba(0,0,0,.5);
background-position: center;
}
// some helper classes for bootstrap3
@nix1947
nix1947 / faicon-circle.css
Last active December 18, 2016 07:35
font-awesome-circle-icon
.fa-icon{
background-color: #2D3033;
color: silver;
padding: 10px;
border-radius: 50%;
text-align: center;
vert-align: middle;
width: 30px;
height: 30px;
@nix1947
nix1947 / es6.js
Last active December 20, 2016 18:15
Es6 cheatsheet
// Defining new function in Es6
// App is the
const App = () => {
return "Hello world";
}
// new keyword
const = "Title" // Can only assigned once.
// Exporting the module
@nix1947
nix1947 / pre-push
Created February 3, 2017 09:59
prevent accidental push to master branch while using git
#!/bin/bash
# save this script to .git/hooks/pre-push
# Change the permission as chmod +x .git/hooks/pre-push
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
@nix1947
nix1947 / gist:5478a5e321f093fb52f7c59f7228f014
Created February 5, 2017 09:21
Enable media display in django in development server
1. Enable the media context processor, from settings.py file
django.template.context_processors.media
2. Set MEDIA_URL and MEDIA_ROOT in settings.py file
MEDIA_URL = '/media'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
3. Serve the media from development server in url.py file
# Serving media files during development
@nix1947
nix1947 / supervisor.conf
Created February 7, 2017 09:59
supervisor configuration for django
[program:example]
command=/webapps/example.com/gunicorn_start.sh
user=webapps
stdout_logfile=/webapps/example.com/logs/gunicorn_supervisor.log
redirect_stderr=true
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8
@nix1947
nix1947 / example.conf
Created February 7, 2017 10:03
nginx configuration for django
upstream example {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
server unix:/webapps/example.com/gunicorn.sock fail_timeout=0;
}
server{
listen 80;
@nix1947
nix1947 / card.html
Created February 11, 2017 02:59
bootstra3 simple cards
<style>
/* card css */
.card{
background-color: red;
margin: 0;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
border-radius: 5px; /* 5px rounded corners */
}