Skip to content

Instantly share code, notes, and snippets.

View bhagyas's full-sized avatar

Bhagya Nirmaan Silva bhagyas

View GitHub Profile
@v1vendi
v1vendi / api_generator.js
Created August 20, 2019 19:19
REST API functional generator
const fetch = (...args) => console.log(...args) // mock
function httpRequest(url, method, data) {
const init = { method }
switch (method) {
case 'GET':
if (data) url = `${url}?${new URLSearchParams(data)}`
break
case 'POST':
case 'PUT':
case 'PATCH':
@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active July 3, 2024 03:59
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@systemed
systemed / gist:be2d6bb242d2fa497b5d93dcafe85f0c
Last active April 10, 2024 03:49
Routing algorithm implementations
(Dijkstra and plain A* are generally not included here as there are thousands of
implementations, though I've made an exception for rare Ruby and Crystal versions,
and for Thor, Mapzen's enhanced A*. )
A* Ruby https://github.com/georgian-se/shortest-path
A* Crystal https://github.com/petoem/a-star.cr
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
@appden
appden / pronto2broadlink.py
Last active July 16, 2023 18:43
Convert Pronto IR hex codes to LIRC pulses then Broadlink packets compatible with python-broadlink
@Sorix
Sorix / RoundedLabel.swift
Last active July 1, 2022 01:33
IBDesignable UILabel with rounded corners and paddings
import UIKit
@IBDesignable
class RoundedLabel: UILabel {
var edgeInsets: UIEdgeInsets {
if autoPadding {
if cornerRadius == 0 {
return UIEdgeInsets.zero
} else {
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active June 23, 2024 21:12
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@brooksduncan
brooksduncan / scan-apple-notes.scpt
Last active September 14, 2023 15:41
ScanSnap Scan To Apple Notes
(*
Scan To Apple Notes
Copyright (C) Brooks Duncan
v. 1.1
You are welcome to use and modify as you see fit, but I'd appreciate credit to http://www.documentsnap.com.
Learn more at http://www.documentsnap.com/scan-apple-notes
Thank you to Larry Salibra at https://www.larrysalibra.com/evernote-to-apple-notes/.
@watson
watson / airplay.md
Last active February 5, 2022 03:41
An overview over my AirPlay related modules
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active June 29, 2024 22:54
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@higepon
higepon / API.swift
Last active July 31, 2023 16:00
An example of JSON API call in Swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>