Skip to content

Instantly share code, notes, and snippets.

Ashraful Alam ashecret

  • Pinro
  • London
Block or report user

Report or block ashecret

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
@ashecret
ashecret / clean-scrollbar.css
Created Apr 19, 2018 — forked from devinrhode2/clean-scrollbar.css
Like, basically PERFECT scrollbars
View clean-scrollbar.css
/**
* Like, basically PERFECT scrollbars
*/
/*
It's pure CSS.
Since a quick google search will confirm people going crazy about Mac OS Lion scrollbars...
this has no fade-out effect.
In Mac OS Lion, the lowest common denominator is always showing scrollbars by a setting.
@ashecret
ashecret / node-deploy-as-upstart-service.md
Last active Jan 27, 2018 — forked from learncodeacademy/node-deploy-as-upstart-service.md
Deploy Node.js app on Ubuntu as Upstart Service - instead of using Forever
View node-deploy-as-upstart-service.md

Deploying a node app with Forever is great...until your server restarts unexpectedly. Then your app stops running and you have to re-deploy.

To get around this, we're going to run our node app as an Upstart service. Upstart services are great, because, once started, the system auto-restarts them if they fail, or if the server restarts.

###Step 1: Create a service for your node app

  • ssh in as root ssh root@youripaddress
  • Create a node-app.conf file in /etc/init
    IMPORTANT: whatever filename you pick is what you will use to start|stop|restart your service i.e. service node-app start
@ashecret
ashecret / flightplan-deploy.md
Last active Jan 27, 2018 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan
View flightplan-deploy.md

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@ashecret
ashecret / deployUser.md
Created Jan 27, 2018 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux
View deployUser.md

(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

View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ashecret
ashecret / gitflow-breakdown.md
Created Jan 17, 2018 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@ashecret
ashecret / almostIncreasingSequence.js
Last active Jun 21, 2018
CodeFight: Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.
View almostIncreasingSequence.js
function almostIncreasingSequence(sequence) {
var found = 0;
for (var i=0;i<sequence.length;i++) {
if(sequence[i] <= sequence[i-1]) {
found++;
// check if more than one nonincreasing found
if(found > 1) return false;
// check if second previous number is equal to / bigger than current number
@ashecret
ashecret / browser_detect.js
Created Dec 22, 2017 — forked from 2107/browser_detect.js
JavaScript: Detect Browser
View browser_detect.js
// browser detect
var BrowserDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function(data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
@ashecret
ashecret / postgres-brew.md
Created Nov 6, 2017 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)
View postgres-brew.md

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@ashecret
ashecret / installing_composer_with_brew.md
Last active Sep 19, 2017
How to install PHP and Composer on a Mac with Homebrew
View installing_composer_with_brew.md

Install PHP an Composer

  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • brew install php56
  • brew install composer

You can replace 56 with your preferred version, i.e. php71

You can’t perform that action at this time.