Skip to content

Instantly share code, notes, and snippets.

View rahulvramesh's full-sized avatar
💻
#bud

Rahul V Ramesh rahulvramesh

💻
#bud
View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active June 13, 2024 21:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@josephspurrier
josephspurrier / etc-init.d-hello-world
Last active May 15, 2021 17:14
/etc/init.d Script for Go Application
#!/bin/bash
#
# chkconfig: 35 95 05
# description: Hello world application.
# Run at startup: sudo chkconfig hello-world on
# Load functions from library
. /etc/init.d/functions
@tomysmile
tomysmile / mac-setup-redis.md
Last active May 23, 2024 03:17
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@krambertech
krambertech / Component.jsx
Created July 2, 2016 10:44
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();
@gambol99
gambol99 / gist:d55afd69217b8e2dd727be99f0a20e7d
Created June 24, 2016 14:44
golang - create ca and build csr for signing
//
// createCertificateAuthority generates a certificate authority request ready to be signed
//
func (r *secretStore) createCertificateAuthority(names pkix.Name, expiration time.Duration, size int) (*caCertificate, error) {
// step: generate a keypair
keys, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
return nil, fmt.Errorf("unable to genarate private keys, error: %s", err)
}
@fpg1503
fpg1503 / DragView.swift
Last active January 31, 2020 20:10
Drag and Drop View on macOS
protocol DragViewDelegate {
var acceptedFileExtensions: [String] { get }
func dragView(dragView: DragView, didDragFileWith URL: NSURL)
}
class DragView: NSView {
required init?(coder: NSCoder) {
super.init(coder: coder)
registerForDraggedTypes([NSFilenamesPboardType, NSURLPboardType])
@albulescu
albulescu / download.go
Created March 25, 2016 09:44
golang download file with progress
package main
/**
* @website http://albulescu.ro
* @author Cosmin Albulescu <cosmin@albulescu.ro>
*/
import (
"bytes"
"fmt"
@alyssaq
alyssaq / main.go
Last active February 13, 2024 08:01
GET and POST golang API
/*
* Sample API with GET and POST endpoint.
* POST data is converted to string and saved in internal memory.
* GET endpoint returns all strings in an array.
*/
package main
import (
"encoding/json"
"flag"