Skip to content

Instantly share code, notes, and snippets.

View msarit's full-sized avatar
☀️
Ready for Spring!

Arit Developer msarit

☀️
Ready for Spring!
View GitHub Profile
- name: Home
link: /
- name: About
link: /about.html
<nav>
<a href="/">Home</a>
<a href="/about.html">About</a>
</nav>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<title>Home</title>
</head>
def build_page_data
categories = {}
@page_data.each do |row|
categories[row[:group_id]] = format_data(row) unless categories[row[:group_id]].present?
categories[row[:group_id]][:features] << features_hash(row)
end
categories
end
def build_page_data
current_id = nil
categories = {}
features = []
@page_data.each do |row|
if row[:group_id] != current_id
categories[current_id][:features] = features unless features.empty?
features = []
current_id = category[:group_id]
@msarit
msarit / component.js
Last active July 26, 2019 16:42
example-code.js
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
function setAction(actions){
let action = actions[getRandomInt(6)];
if (action === 'gives away') { setAction(actions) }
else { return action }
}
<!-- HTML -->
<section class="skills" id="skills">
<h1 style="margin: 40px 0px;">Skills & Tools</h1>
<div class="container">
<div class="row">
<div class="col-12 col-sm-6 col-md-4 skills-list">
<span><img src="img/htmlcss.png" /><br />
HTML/CSS</span>
</div>
<div class="col-12 col-sm-6 col-md-4 skills-list">
@msarit
msarit / postgres cheatsheet.md
Created September 17, 2018 18:48 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@msarit
msarit / gist:aefa82e164d89b23b80131a5e131fd5b
Created June 14, 2018 22:42 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
def move_to!(x,y)
destination = game.pieces.find_by(location_x: x, location_y: y)
if destination.nil?
self.update_attributes(location_x: x, location_y: y)
elsif self.white != destination.white
destination.update_attributes(location_x: nil, location_y: nil, notcaptured: false)
self.update_attributes(location_x: x, location_y: y)
else
flash[:alert] = "Cannot move there; occupied by friendly"