Skip to content

Instantly share code, notes, and snippets.

View ronbeltran's full-sized avatar

Ronnie Beltran ronbeltran

View GitHub Profile
@ronbeltran
ronbeltran / vim_crash_course.md
Created August 3, 2022 14:42 — forked from dmsul/vim_crash_course.md
Vim Crash Course

NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.

NORMAL MODE

Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.

Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.

:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.

@ronbeltran
ronbeltran / Beer.java
Created March 27, 2012 08:46
99 Bottles of Beer in Java
class Beer {
/* Prints the lyrics of "99 Bottles of Beer" */
public static void lyrics(int bottles){
if(bottles == 0){
System.out.println();
System.out.println("No bottles of beer on the wall, no bottles of beer, ya' can't take one");
System.out.println("down, ya' can't pass it around, 'cause there are no more bottles of beer on the wall!");
} else {
System.out.println(bottles + " bottles of beer on the wall," + bottles + " bottles of beer, ya' take one");
@ronbeltran
ronbeltran / postgres-brew.md
Created February 26, 2021 05:33 — forked from ibraheem4/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
@ronbeltran
ronbeltran / bf.py
Created December 31, 2020 04:18
Naive Brainfuck Interpreter
# https://en.wikipedia.org/wiki/Brainfuck
import sys
from typing import List
class BF:
def __init__(self, code: str) -> None:
self.memory: List[int] = [0] * 30000
self.code = code
self.ip: int = 0
@ronbeltran
ronbeltran / heroku-remote.md
Created October 20, 2020 14:00 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@ronbeltran
ronbeltran / gist:7701123
Last active March 2, 2020 09:57
Need to optimize
$CS2 = mysql_query("SELECT VID, AN FROM Cl WHERE VID = '$VID' ");
while( $row = mysql_fetch_array($CS2) ) {
$AN1 = $row['AN'];
$VID = $row['VID'];
$BA = 0;
$PA = 0;
$TB = 0;
$Ba = 0;
@ronbeltran
ronbeltran / README.md
Created January 31, 2020 00:25 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@ronbeltran
ronbeltran / .htaccess
Created November 19, 2019 07:27 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ronbeltran
ronbeltran / install.sh
Created November 21, 2018 02:39 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`