This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mac-deals-checker.core | |
(:require [reaver :refer [parse extract-from text]])) | |
(def deal-url "http://www.apple.com/sg/shop/browse/home/specialdeals/mac") | |
(defn latest-deals-info | |
[] | |
(-> deal-url slurp parse (extract-from ".product" [:spec :price] "td.specs" text "span.current_price span span" text))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa -b 2048 -v | |
cat server.pub >> .ssh/authorized_keys | |
# rename server server.pem | |
# Distribute server.pem to login. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. In mix.exs, create | |
defp package do | |
[ | |
files: ["lib", "mix.exs", "README", "LICENSE*"], | |
maintainers: ["Your Name"], | |
licenses: ["Apache 2.0"], | |
links: %{"GitHub" => "https://github.com/fteem/some_app_name"} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Algorithmia = require("algorithmia"); | |
const request = require('request'); | |
exports.apply = function(input, cb) { | |
let url = 'http://104.196.34.244:80/' + input; | |
request(url, function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
out = body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.EncryptedField do | |
@behaviour Ecto.Type | |
def type, do: :binary | |
def cast(value) do | |
{:ok, to_string(value)} | |
end | |
# This is called when the field value is about to be written to the database |