Skip to content

Instantly share code, notes, and snippets.

@adamakhtar
adamakhtar / obsidian-web-clipper.js
Created September 9, 2023 15:06 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
{
"tags": {
"load_all": true,
"exclude": ["created_by", "source", "source:datetime"]
},
"generalized_tables": {
"water_areas_gen_50_gt_500_000": {
"source": "water_areas",
"sql_filter": "ST_Area(geometry)>500000.000000",
"tolerance": 50.0
@adamakhtar
adamakhtar / gist:61df512a732c7c80c32d390505da93c8
Created August 28, 2021 02:31 — forked from jendiamond/gist:6128723
Creating your own Gem & Command Line Interface Using Bundler

Presentation slides

Create a Gem - Make it a CLI - Add Rspec Tests

Create a Gem - Make it a Command Line Interface - Add Rspec Tests Using Bundler & Thor

#Creating your own Gem

  1. Run this command in your Terminal. This creates and names all the files you need for your gem. We are going to create a Lorem Ipsum Generator; you can call it whatever you want but seeing as we are creating a Lorem Ipsum generator we'll call it lorem. Read about gem naming conventions.
@adamakhtar
adamakhtar / jquery.spin.js
Created September 26, 2012 15:04 — forked from innotekservices/jquery.spin.js
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
resource_name = if resource.class.respond_to?(:model_name)
resource.class.model_name.human
else
resource.class.name.underscore.humanize
end
#Here we want to include Rails Il8n functionality but since the host is a
#module and modules cant include other modules, we create an Object instanc
#and extend it.
#https://github.com/plataformatec/responders/blob/master/lib/responders/flash_responder.rb
module FlashResponder
class << self
attr_accessor :flash_keys, :namespace_lookup, :helper
@adamakhtar
adamakhtar / a.rb
Created August 15, 2012 06:07
Allocate : Create an object but avoid initialization.
#allocate()
#Allocates space for a new object of class’s class and does not call initialize on the new instance. The returned object #must be an instance of class.
klass = Class.new do
def initialize(*args)
@initialized = true
end
def initialized?
@initialized || false
@adamakhtar
adamakhtar / a.rb
Created August 15, 2012 04:39
Quick way to pass params to File.join (avoid lots of "")
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])