Skip to content

Instantly share code, notes, and snippets.

View ashecret's full-sized avatar

Ashraful Alam ashecret

View GitHub Profile
@ashecret
ashecret / gist:1250381d27fdc94466db971cf7bb903a
Created November 3, 2016 14:55 — forked from hatch2/gist:3681758
use json_encode & json_decode at old php
<?php
//JSON.php -> http://pear.php.net/package/Services_JSON/
require_once 'JSON.php';
if ( !function_exists('json_decode') ){
function json_decode($content, $assoc=false){
if ( $assoc ){
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
@ashecret
ashecret / pickRandomComment.js
Created May 24, 2017 22:53 — forked from learncodeacademy/pickRandomComment.js
YouTube Random Comment Selector
const axios = require("axios");
const key = "AIzaSyB9e-dHIvdxxrbmorjYHWipwBKq7LJBhNk"
function getComments(pageToken, allItems = {}) {
const params = {
key,
videoId: "a4haLJdDRmc",
part: "snippet",
maxResults: 100,
pageToken,
@ashecret
ashecret / nginx-ssl-config
Created July 4, 2017 19:24 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@ashecret
ashecret / installing_composer_with_brew.md
Last active September 19, 2017 15:09
How to install PHP and Composer on a Mac with Homebrew

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

@ashecret
ashecret / postgres-brew.md
Created November 6, 2017 15:04 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

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 / browser_detect.js
Created December 22, 2017 12:49 — forked from 2107/browser_detect.js
JavaScript: Detect Browser
// 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 / almostIncreasingSequence.js
Last active February 13, 2024 13:35
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.
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 / gitflow-breakdown.md
Created January 17, 2018 23:16 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

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 / tmux-cheatsheet.markdown
Created January 23, 2018 14:47 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ashecret
ashecret / deployUser.md
Created January 27, 2018 21:20 — 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