Skip to content

Instantly share code, notes, and snippets.

Ryan Wilcox rwilcox

Block or report user

Report or block rwilcox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rwilcox
rwilcox / standalone.js
Created Mar 15, 2019
Ever wanted to just give someone a single .js file, but also wanted to pull in a Node module? Fret no more!
View standalone.js
#!/usr/bin/env node
/*
Node script are kind of cool, but they are hard to low-tech write a Node script for someone and give it to them.
Sure you can publish a package to NPM, set the binary flag, go through some house keeping... but sometimes that's just
not worth the effort.
So: can you distribute a Node script that will install it's own modules from a single file?
View web_api_play_thoughts.js
const process = require("process")
const superagent = require('superagent')
const Ajv = require("ajv")
// This example is inspired by the idea of https://riposte.in/
// although that package has a way better DSL by not being written in Javascript
// Normally a playground script like this would serve two purposes:
// 1. All developers to pass around scripts of things that Should Work
View security_phrases.py
#from faker import Faker
#fake = Faker('en_US')
#print fake.words() # sentence() #bs() # catch_phrase()
import requests
import random
def main():
@rwilcox
rwilcox / bb_toggle_distraction_free.applescript
Last active Aug 29, 2015
Turn BBEdit into a distraction free writing environment
View bb_toggle_distraction_free.applescript
tell application "BBEdit"
tell window 1
set show line numbers to (not show line numbers)
set show toolbar to (not show toolbar)
set show gutter to (not show gutter)
set show navigation bar to (not show navigation bar)
-- set show status bar to false
end tell
end tell
@rwilcox
rwilcox / frontmost_to_two_spaces.applescript
Created Nov 30, 2014
Sets the frontmost BBEdit window to 2 spaces and auto expand tabs
View frontmost_to_two_spaces.applescript
tell application "BBEdit"
tell text window 1
set tab width to 2
set expand tabs to true
end tell
end tell
View maybe_coffeescript_bug.coffee
myF = () ->
true
formattedOutput =
full_name: "Ryan Wilcox"
username: "rwilcox"
needs_profile_update: myF() ? "YES" : "NO"
# ^^^ generates (_ref = myF()) != null ? _ref : {"YES": "NO"}
# Ummm... that's odd...
@rwilcox
rwilcox / csv_write_example_csv_020.coffee
Created Jul 22, 2014
Using the CSV NPM module, version 0.2.0, turn objects into CSV
View csv_write_example_csv_020.coffee
# An example project showing how to write objects using the CSV npm package
#
# Uses the CSV 0.2.0 style syntax. For an example that shows CSV 0.4.0
# (major syntax change) see https://gist.github.com/rwilcox/e8411242ffe4f06af35c#file-objects_to_csv-coffee
csv = require 'csv'
util = require 'util'
# Use the callback API to write this
callback_generate_csv_from_list = (records_to_write, cb) ->
@rwilcox
rwilcox / csv_write_example_csv_020.coffee
Created Jul 22, 2014
Using the CSV NPM module, version 0.2.0, turn objects into CSV
View csv_write_example_csv_020.coffee
# An example project showing how to write objects using the CSV npm package
#
# Uses the CSV 0.2.0 style syntax. For an example that shows CSV 0.4.0
# (major syntax change) see https://gist.github.com/rwilcox/e8411242ffe4f06af35c#file-objects_to_csv-coffee
csv = require 'csv'
util = require 'util'
# Use the callback API to write this
callback_generate_csv_from_list = (records_to_write, cb) ->
@rwilcox
rwilcox / objects_to_csv.coffee
Last active Aug 29, 2015
Using the CSV NPM Package, turn objects into CSV
View objects_to_csv.coffee
# An example project showing how to write objects using the CSV npm package
csv = require 'csv'
util = require 'util'
# Use the callback API to write this
callback_generate_csv_from_list = (records_to_write, cb) ->
map_reduce_it = []
@rwilcox
rwilcox / find_from_top.applescript
Created Jun 17, 2014
Start find from top in BBEdit
View find_from_top.applescript
(*
This Applescript lets you do a search starting at the top of the current document, NOT where the cursor is currently positioned
Author: Ryan Wilcox
Date: June 17, 2014
License: Public Domain
*)
property oldSearchString : "fish"
You can’t perform that action at this time.