Skip to content

Instantly share code, notes, and snippets.

View drochetti's full-sized avatar
🎧
New projects!

Daniel Rochetti drochetti

🎧
New projects!
View GitHub Profile
@drochetti
drochetti / AmplifyGlideIntegration.kt
Created March 27, 2021 05:54
Amplify + Glide integration for image rendering
import android.content.Context
import com.amplifyframework.core.Amplify
import com.amplifyframework.storage.StorageAccessLevel
import com.amplifyframework.storage.operation.StorageDownloadFileOperation
import com.amplifyframework.storage.options.StorageDownloadFileOptions
import com.bumptech.glide.Glide
import com.bumptech.glide.Priority
import com.bumptech.glide.Registry
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.DataSource
@drochetti
drochetti / ContentView.swift
Last active November 23, 2020 23:44
Amplify+Kingfisher
import Amplify
//import AmplifyExtensions
import struct Kingfisher.KFImage
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Button(action: onFileUpload) {
Text("Upload file")
@drochetti
drochetti / osx_setup.sh
Last active February 26, 2021 07:45 — forked from codeinthehole/osx_bootstrap.sh
Script to install/upgrade stuff an OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Reading:
#
# - http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
@drochetti
drochetti / blowout-api-client-client.rb
Created September 18, 2014 15:49
ruby rest client poc
module Blowout
module Api
Client = RC::Builder.client do
use RC::DefaultSite, 'http://localhost:7272'
use RC::JsonResponse, true
use Blowout::Api::HashResponse
@drochetti
drochetti / blowout-api-client-base.rb
Created September 18, 2014 15:48
ruby rest client poc
module Blowout
module Api
class BaseResource < Hashie::Mash
# include RestCore
# include Blowout::Api
# include Blowout::Api::Client
// Use absolute URLs to navigate to anything not in your Router.
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
// Use delegation to avoid initial DOM selection and allow all matching elements to bubble
$(document).delegate("a", "click", function(evt) {
// Get the anchor href and protcol
var href = $(this).attr("href");
var protocol = this.protocol + "//";
@drochetti
drochetti / Session.js
Last active December 9, 2015 20:28
A Javascript snippet representing a session, but not the web one... =)
(function(global) {
var myself = global.people.findById(global.github.me.dna()); // lol
myself.roll = myself.roll || function(weed, paper) {
weed = this.getGrinder().grind(weed);
return _.extend(weed, paper);
};
var session = new Session({
location : Location.SAME_OLD_SPOT,
people : _.union([myself], myself.getFriends().filter(Person.POT_HEAD))
@drochetti
drochetti / t2g-cypher-query.java
Created August 31, 2012 19:42
Neo4j Cypher query
query.append("START activity = node:__types__(className={activityClass}) ")
// .append("MATCH (activity)-[*1..2]->(source), ")
// .append("(source)<-[:HAS_SOURCE]-(lastActivities) ")
.append("MATCH (activity)-[*1..2]->(source)<-[:HAS_SOURCE]-(lastActivities) ")
.append("WHERE source.__type__ in {sourceTypes} ")
.append("RETURN source as source, COLLECT(lastActivities) as activities ")
// .append("ORDER BY activity.when DESC LIMIT 20"); why can't I use activity anymore? because of second match
.append("LIMIT 20");