Skip to content

Instantly share code, notes, and snippets.

View emckean's full-sized avatar
💭
have I told you about Wordnik?

Erin McKean emckean

💭
have I told you about Wordnik?
View GitHub Profile
@chrismdp
chrismdp / s3.sh
Last active January 23, 2025 09:26
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@benkehoe
benkehoe / awssh
Last active January 31, 2017 21:59
AWS EC2 ssh shell functions
# Shell functions for ssh-ing into and
# Features automatic adding of the key file when it is specified in
# AWSSH_KEY. If no user is given in the hostname, it will use the value
# in AWSSH_DEFAULT_USER, or ec2-user if that is not set.
# Sets StrictHostKeyChecking off, so it doesn't ask you if you want to
# connect. Doesn't add the IP to known_hosts, though it will warn you
# every time that it has.
awssh ()
(
@robinsloan
robinsloan / pcal.rb
Created March 11, 2015 17:42
Add entries for prime-numbered weekdays to your Google calendar. Useful to literally no one but me.
require "rubygems"
require "google_calendar"
require "date"
require "prime"
# Create an instance of the calendar.
cal = Google::Calendar.new(:client_id => "foo"
:client_secret => "bar",
:calendar => "blee",
@nijikokun
nijikokun / generateJsonSchema.js
Created February 16, 2015 23:19
Generate (BASIC) JSON Schema from JSON Object
var Type = require('type-of-is')
module.exports = function generateJsonSchema (object) {
for (var key in object) {
var value = object[key]
var type = Type.string(value).toLowerCase()
if (type === 'undefined') {
type = 'null'
}
@brianmacarthur
brianmacarthur / flash-app.js
Last active March 19, 2025 14:21
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@yurivictor
yurivictor / predictions_2014.json
Created December 24, 2014 15:06
Nieman Lab End of Year predictions 2014
[
{
"url": "http:\/\/www.niemanlab.org\/2014\/12\/content-creators-are-users-too\/",
"story": "We\u2019ve seen a lot of innovation over the past few years in how content is presented: Circa leveraging mobile to deliver evolving topics, Vox card stacks bringing context to news, and sites continuing to raise the bar for visual storytelling. It\u2019s an exciting time, and there\u2019s plenty more to come as companies continue to bring journalism and technology together. But while consumers are reaping the benefits of this content revolution, it seems like we\u2019ve left creators in the dust. That gorgeous longform template with infographics and parallax effects or that streamlined feed of latest news is a great experience for the user, but they can be a nightmare for those building them. Editors are often left to their own devices, forced to navigate clunky CMSes and connect the dots between form fields and what users will see. That\u2019s all starting to change. Medium was the first product to revol
@scazon
scazon / gist:a427f58974b6e7c80827
Last active January 16, 2018 04:47
Generating Random Words with Google Apps Script and Wordnik
/*--------------------------
Here's how I use Wordnik in my Twitter bots to get random words.
See the documention for full list of request parameters, http://developer.wordnik.com/docs.html
--------------------------*/
var WORDNIK_API_KEY = "YOUR_KEY_HERE";
//Get your API key from developer.wordnik.com
var WIKI_URL = "http://en.wiktionary.org/w/api.php?format=json&action=query&prop=categories&redirects=1&titles=";
//This is the wiktionary API url to get word category lists, used for filtering offensive words
@moonmilk
moonmilk / README.md
Last active February 2, 2025 15:46
manually authorize a twitter app to a twitter account

So you're writting a twitterbot and you need to authorize your application to post to the account. You need an access token and secret for the account you're posting to. If the posting account is the same account that owns the application, no problem, you just push the button on your application's settings page to make the keys. But if you want to post to a different twitter account, there's no UI on apps.twitter.com to authorize it. So I made this bare-minimum node server to run through the authorization process. There's probably a much better way to do this, so please let me know what that way is!

ignore this and go down to the comments for better solutions

  • You'll need a server with node.js!
  • Make sure your application has a callback URL specified in its settings page, even if it's just a placeholder. If there's nothing in the callback URL slot, this method of authorization won't work.
  • In authorize.js, fill in your application's consumer key and secret, and the domain on which you'll be running th
@ftrain
ftrain / actually.js
Last active November 10, 2023 01:16
A program that generates actuallies
/*
actually.js
_ _ _
__ _ __ _ __ _ __ _ ___| |_ _ _ __ _| | |_ _
/ _` |/ _` |/ _` |/ _` |/ __| __| | | |/ _` | | | | | |
| (_| | (_| | (_| | (_| | (__| |_| |_| | (_| | | | |_| |_
\__,_|\__,_|\__,_|\__,_|\___|\__|\__,_|\__,_|_|_|\__, ( )
|___/|/
*/
@masatomo
masatomo / gist:983a84bad9671dc29213
Last active February 28, 2018 08:49
How to use MongoDB 2.6.x on CircleCI (circle.yml)
dependencies:
cache_directories:
- mongodb-linux-x86_64-2.6.4
pre:
- if [[ ! -d mongodb-linux-x86_64-2.6.4 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz && tar xvzf mongodb-linux-x86_64-2.6.4.tgz; fi
- sudo /etc/init.d/mongodb stop
- sudo cp mongodb-linux-x86_64-2.6.4/bin/* /usr/bin
- sudo /etc/init.d/mongodb start