View test
Algorithmia = require("algorithmia");
const request = require('request');
exports.apply = function(input, cb) {
let url = '' + input;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
out = body
View gcdatastore.js
const gcloud = require('gcloud');
const _ = require('lodash');
const cache = require('./cache');
const log = console.log;
const config = {projectId: process.env.GCLOUD_PROJECT || 'brydge-api'}
const ds = gcloud.datastore(config);
View publish_elixir_lib_cheatsheet
1. In mix.exs, create
defp package do
files: ["lib", "mix.exs", "README", "LICENSE*"],
maintainers: ["Your Name"],
licenses: ["Apache 2.0"],
links: %{"GitHub" => ""}
View Create PEM file
ssh-keygen -t rsa -b 2048 -v
cat >> .ssh/authorized_keys
# rename server server.pem
# Distribute server.pem to login.
View gitconfig
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
l = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
View mac-deals-scrapper.clj
(ns mac-deals-checker.core
(:require [reaver :refer [parse extract-from text]]))
(def deal-url "")
(defn latest-deals-info
(-> deal-url slurp parse (extract-from ".product" [:spec :price] "td.specs" text "span.current_price span span" text)))
View gist:c4f793e953f7d8623acb
var safeImageURI = function(s) { return encodeURI(s).replace(/\-/g, "%2D").replace(/\_/g, "%5F").replace(/\./g, "%2E").replace(/\!/g, "%21").replace(/\~/g, "%7E").replace(/\*/g, "%2A").replace(/\'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29"); }
View gist:6208758
This is all you need to know about Clojure’s namespace declarations:
(ns my-project.core
; :require Clojure libs
(:require clojure.core.async
[compojure.core :refer [POST routes]]
[compojure.handler :refer :all]
[ring.adapter.jetty :as jetty]
[clojure.edn :as edn :refer [read]])
; :import for Java classes
View gist:5972209
co = checkout
br = branch
ci = commit
st = status
last = log -1 HEAD
visual = !gitk
l = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
View haze-api.clj
(ns haze-api.core
(:require [net.cgrand.enlive-html :as html])
(def doe-url "")
(defn rows-by-enlive
(let [site (html/html-resource ( url))
rows (html/select site [:table.table1 :tr])]