Provide SHOPIFY_SUBDOMAIN
, SHOPIFY_EMAIL
and SHOPIFY_PASSWORD
environment variables, and discount.rb
will configure itself.
Supported APIs are
Discount.find(:all)
Discount.find(:first)
Discount.create(...)
Discount#destroy
// 1. Open the browser developper console on the network tab | |
// 2. Start the video | |
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL | |
// 4. Run: node vimeo-downloader.js "<URL>" | |
// (done automatically now) 5. Combine the m4v and m4a files with mkvmerge | |
const fs = require('fs'); | |
const url = require('url'); | |
const https = require('https'); | |
const { exec } = require('child_process'); |
from __future__ import print_function | |
import json | |
import os | |
import numpy as np | |
from gensim.models import Word2Vec | |
from gensim.utils import simple_preprocess | |
from keras.engine import Input | |
from keras.layers import Embedding, merge |
using TechTalk.SpecFlow; | |
namespace MyCompany.SpecFlowTests | |
{ | |
[Binding] | |
public static class Hooks | |
{ | |
[BeforeFeature] | |
public static void BeforeFeature() | |
{ |
public static class ExtensionMethods { | |
public static string ToUnderscoreCase(this string str) { | |
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower(); | |
} | |
} |
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"
#!/usr/bin/env ruby | |
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API | |
require 'open-uri' | |
require 'json' | |
require 'tmpdir' | |
def itunes_song | |
`osascript -e 'tell application "iTunes" to (get name of current track) & "\n" & (get artist of current track)' 2>/dev/null`.split("\n") |
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
# rake deploy[env,branch] # Notice no spaces in arguments! | |
require 'net/ssh' | |
# Config for stage env | |
@stage_ssh = "dev.server.com" | |
@stage_path = "/path/to/staging/root/" | |
@stage_user = "your_username" | |
@stage_pass = "your_password" | |
@stage_port = port |
#! /usr/bin/env ruby | |
# usage: | |
# $ das_download.rb email password [download_directory] | |
require 'mechanize' | |
# gem 'mechanize-progressbar' | |
email = ARGV[0] or raise('Please provide the email address for your account') | |
password = ARGV[1] or raise('Please provide the password for your account') | |
path = ARGV[2] || './' |