View carousell.txt
iex(8)> c1 = ";localeCookies=true;path=%2F2.1%2Fproducts%2F;query=%7B%22count%22%3A31%2C%22start%22%3A0%2C%22sort%22%3A%22lowest_price%22%2C%22price_start%22%3A2000%2C%22query%22%3A%22rolex%20explorer%2039mm%202016%22%2C%22toggle_shippable%22%3A1%2C%22latitude%22%3A%22%22%2C%22longitude%22%3A%22%22%2C%22lte%22%3A%22%22%2C%22unit%22%3A%22%22%2C%22country_id%22%3A%221880251%22%2C%22country_code%22%3A%22SG%22%7D?_csrf=lY4VP8gA-VL4l1oTBrjxzVwVWronwIMzSPFQ&returnMeta=true"
iex(9)> URI.decod
View encrypted_field.ex
defmodule MyApp.EncryptedField do
@behaviour Ecto.Type
def type, do: :binary
def cast(value) do
{:ok, to_string(value)}
# This is called when the field value is about to be written to the database
View question1.clj
;; Hardcode the input data here as `data`
(def data `({:content "Message from User 2"
:from {:id 2 :name "User 2" :type :user :updated "2000-03-05T16:49:56.845Z"}
:to {:id 22 :name "Group 22" :type :group :updated "1991-10-19T00:57:39.527Z"}
:type :message}
{:content "Message from User 1"
:from {:id 1 :name "User 1" :type :user :updated "1980-07-21T18:56:27.379Z"}
:to {:id 3 :name "User 3" :type :user :updated "1984-05-16T19:57:44.739Z"}
View ref_consistency_multithreaded_test.clj
;; Question 2
;; 1. Create a unit test that reproduces the problem
;; 2. Explain what is going wrong
;; 3. Fix the bug
;; 0. Start with the ref a, ref b and the advance-* functions
(def a (ref 1))
(def b (ref 1))
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)))