Skip to content

Instantly share code, notes, and snippets.

@snggeng
snggeng / dependent-diffs.txt
Last active March 5, 2020 21:24 — forked from zackdever/gist:8701478
arc diff off another diff
Topic: Dependent Phabricator reviews
Say you have an upstream called master, and a feature branch F1, and a second change that depends on F1, (call it F2).
git checkout master
git checkout -b F1
# work work
git commit -a
arc diff
git checkout -b F2 # Note that F1 is set as the upstream of F1
# set upstream, in this format git branch -u <remote>/<branch>
@snggeng
snggeng / startmongo
Created September 15, 2019 00:29
executable to start mongo db
#!/bin/bash
mongod --dbpath ./db --logpath ~/mongologs/mongod.log
@snggeng
snggeng / connect-remote-mongo-via-ssh-tunnel.md
Created March 22, 2018 11:33 — forked from umidjons/connect-remote-mongo-via-ssh-tunnel.md
Create ssh tunnel and connect to the remote mongo database on command line

Create ssh tunnel and connect to the remote mongo database on command line

Assume followings:

/mykeys/.ssh/prodserver.pem - is a certificate file

umid - is a user name

111.111.111.111 - is a remote host, that mongodb runs

@snggeng
snggeng / test.md
Last active July 15, 2022 12:25
Setting up Automated Testing & CI
@snggeng
snggeng / git-workflow.md
Created January 18, 2018 16:46 — forked from forest/git-workflow.md
Git Feature Branch Workflow

We subscribe to the Git Featrue Branch workflow, briefly described in that link.

In practice, it works as follows:

FEATURE DEVELOPMENT

Steps to Follow:

  1. Start with an updated local development branch -- by checking out the dev branch and pulling changes:
    git checkout development
    git pull origin development
@snggeng
snggeng / game.js
Last active June 7, 2017 12:02
Spawn enemy in game.js
// Setup event listeners
function setupEvents() {
// Add event listeners for different types of events in the game
// code omitted for brevity
}
// Spawn enemy
function spawnEnemy(){
var enemy = new Enemy();
assets.push(enemy)
@snggeng
snggeng / enemy.js
Last active June 7, 2017 11:57
Enemy object
const Enemy = function(settings) {
// Settings
let enemyElement = null
// Prevent enemy from escaping the game window
function wall() {
const enemyRect = enemyElement.getBoundingClientRect() // get the active style values of our moving enemy
const w = parseInt(window.innerWidth)
@snggeng
snggeng / game.js
Created June 6, 2017 02:16
Setting up event listeners
// Setup event listeners
function setupEvents() {
document.addEventListener('keyup', function(event){
var keyName = event.key;
switch(keyName) {
case "ArrowRight":
interactions.right = false;
break;
@snggeng
snggeng / player.js
Created June 6, 2017 02:07
Move function
// Move the ball around manually
function move(interactions){
if(interactions.up){
playerElement.style.top = parseInt(playerElement.style.top)-8+"px";
}
if(interactions.down){
playerElement.style.top = parseInt(playerElement.style.top)+8+"px";
}
@snggeng
snggeng / player.js
Last active June 6, 2017 02:02
create function
// Create the object asset
function create() {
// in-line styling is important because we will be using the element's
// in-line styling to manipulate it's movement, as above in the move()
// function
playerElement = document.getElementById('player');
playerElement.style.top = '400px';
playerElement.style.left = '400px';
playerElement.style.height = '100px';
}