This file contains 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
FROM python:2.7.12-alpine | |
RUN wget -O- "http://s3.amazonaws.com/babl/babl-server_linux_amd64.gz" | gunzip > /bin/babl-server && chmod +x /bin/babl-server | |
ADD app /data/ | |
RUN ln -s /data/app /bin/app | |
RUN chmod +x /bin/app | |
WORKDIR /data | |
RUN pip install -U pip | |
RUN pip install dropbox | |
CMD ["babl-server"] |
This file contains 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
#!/usr/local/bin/python | |
import dropbox | |
import os | |
import sys |
This file contains 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
def main(): | |
tempFile = ''.join(sys.stdin.readlines()) | |
try: | |
token = os.environ["TOKEN"] | |
dest_path = os.environ["FILE"] | |
except KeyError as err: | |
print "One or more environment variable are missing, %s" % err | |
return |
This file contains 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
def upload(dbx, data, path, overwrite=False): | |
"""Upload a file. | |
Return the request response, or None in case of error. | |
""" | |
mode = (dropbox.files.WriteMode.overwrite | |
if overwrite | |
else dropbox.files.WriteMode.add) | |
try: | |
res = dbx.files_upload(data, path, mode) |
This file contains 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
# runs rails console and copy + paste this snippet in to see the offending file | |
JS_PATH = "app/assets/javascripts/**/*.js"; | |
Dir[JS_PATH].each do |file_name| | |
puts "\n#{file_name}" | |
puts Uglifier.compile(File.read(file_name)) | |
end |
This file contains 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
db.collection("activities").where("userID", "==", currentUserID) | |
.onSnapshot(function(snapshot) { | |
snapshot.docChanges().forEach(function(change) { | |
doSomething(change.doc.data()); | |
}); | |
}); |
This file contains 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
function handleActivitySubscription(snapshot) { | |
snapshot.docChanges().forEach(function(change) { | |
doSomething(change.doc.data()); | |
}); | |
} | |
const handleActivitySubscriptionWithCounter = | |
createFnCounter(handleActivitySubscription, 1); | |
db.collection("activities").where("userID", "==", currentUserID) |
This file contains 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
import ( | |
"crypto/rand" | |
) | |
func NewRandomKey() []byte { | |
key := make([]byte, 32) | |
if _, err := rand.Read(key); err != nil { | |
// really, what are you gonna do if randomness failed? | |
panic(err) | |
} |
This file contains 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
CREATE TABLE apps ( | |
id SERIAL PRIMARY KEY, | |
name character varying, | |
public_key character varying, | |
encrypted_secret_key character varying, | |
created_at timestamp without time zone NOT NULL, | |
updated_at timestamp without time zone NOT NULL | |
); | |
-- enhance query performance and enforce uniqueness | |
CREATE UNIQUE INDEX apps_public_key ON apps(public_key text_ops); |
OlderNewer