Skip to content

Instantly share code, notes, and snippets.

View candland's full-sized avatar

Dusty Candland candland

View GitHub Profile
@candland
candland / obsidian-web-clipper.js
Last active March 26, 2024 22:45 — forked from Asseel-Naji/obsidian-web-clipper.js
Prompt_Obsidian Bookmarklet to clip pages
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 = "vault";
/* Optional folder name such as "Clippings/" */

Keybase proof

I hereby claim:

  • I am candland on github.
  • I am candland (https://keybase.io/candland) on keybase.
  • I have a public key ASAh2lYDeoJAWBtv2xgMPtR7uXAqC9f_ILjPJP1k73EYuAo

To claim this, I am signing this object:

@candland
candland / 0_reuse_code.js
Created May 1, 2014 21:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre])
(defn with-free-port!
"Attempts to kill any current port-binding process, then repeatedly executes
nullary `bind-port!-fn` (which must return logical true on successful
binding). Returns the function's result when successful, else throws an
exception. *nix only.
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu."
[port bind-port!-fn & {:keys [max-attempts sleep-ms]
(ns middleman.jetty-logger
)
(import org.eclipse.jetty.util.log.Logger)
;; void debug(String msg, Object... args)
;; void debug(String msg, Throwable thrown)
;; void debug(Throwable thrown)
;; void ignore(Throwable ignored)
;; void info(String msg, Object... args)
;; void info(String msg, Throwable thrown)
@candland
candland / Rakefile
Last active June 23, 2021 15:57 — forked from latentflip/Rakefile
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
#The original rails rakefile loading
def load_rails_environment
require File.expand_path('../config/application', __FILE__)
require 'rake'
MyApp::Application.load_tasks
@candland
candland / soap.rb
Created June 21, 2011 21:10
Savon.rb usage with a .net (dotnet) web service
require 'savon'
client = Savon::Client.new do
wsdl.document = 'http://127.0.0.1/services/ContentManager.asmx?WSDL'
end
response = client.request :get_folders, "xmlns" => "http://mycontentservice.com/contentmanagerapi/" do |soap, wsdl|
soap.version = 2
soap.body = { :apikey => "xxxxxxxxxxxxx" }
end
update wp_options set option_value = 'http://localhost' where option_name = 'siteurl';
GRANT ALL PRIVILEGES ON database.* TO 'user_name'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
@candland
candland / _form.html.erb
Created April 30, 2011 02:25
Refinery CMS Image Usage
<%= form_for(@user, :html => {:multipart => true}) do |f| %>
... # Note that field_for needs <%= not just <%
<div class='field'>
<%= f.fields_for :avatar, Image.new do |a| %>
<%= a.label :'image' -%><br/>
<%= image_fu @user.avatar, '150x150' if @user.avatar %><br/>
<%= a.file_field :'image' %>
<% #a.hidden_field :'retained_image_id' %>
@candland
candland / Shorten Text.rb
Created March 8, 2011 01:13
Shorten text helper
def shorten(description, length)
return truncate(description.gsub(/(<[^>]+>)/, ''), :length => length, :omission => "...")
end