Skip to content

Instantly share code, notes, and snippets.

View stve's full-sized avatar

Steve Agalloco stve

View GitHub Profile
@juliangruber
juliangruber / extend.plist
Last active August 23, 2020 18:48
Here is how to accept files dropped on an @electronjs app's icon in osx. For this to work you need to properly package the app into a `.app`, and to place the CFBundleDocumentTypes spec into it's Info.plist. Here we're using electron-packager.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>All Files</string>
<key>LSHandlerRank</key>
@pdtyreus
pdtyreus / Neo4jHealthCheck.java
Created May 7, 2015 21:40
Simple Dropwizard HealthCheck for a Neo4j server
import com.codahale.metrics.health.HealthCheck;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import javax.ws.rs.core.MediaType;
public class Neo4jHealthCheck extends HealthCheck {
@NuckChorris
NuckChorris / array.js
Last active February 12, 2018 19:47 — forked from pixelhandler/transforms.js
In Ember-CLI, transforms are located in app/transforms/name.js
// app/transforms/array.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Transform.extend({
deserialize: function(value) {
if (Ember.isArray(value)) {
return Ember.A(value);
} else {
return Ember.A();
@evanphx
evanphx / gist:358c1627b69f7a33fca6
Created October 29, 2014 16:54
Tachyon installer with hash verification
curl http://tachyon.vektra.io/install.sh > it.sh && test $(openssl sha1 < it.sh) = "23fb0450b152dfaa8331dd37c3a4c13d4de9dbb8" && bash it.sh
@ryandotsmith
ryandotsmith / s_queue.rb
Last active August 29, 2015 14:07
Multi-threaded SQS Ruby Worker. I have tests. Maybe this is a gem? Lemme know if you find it useful.
require 'aws-sdk'
require 'json'
module SQSW
class SQueue
MissingQueue = Class.new(StandardError)
def initialize(url = nil)
raise(MissingQueue, "Missing queue_url") if url.nil?
@q = find_queue(url)
@mgreensmith
mgreensmith / Slack_solarized_themes
Last active May 2, 2024 18:14
Solarized themes for Slack
Solarized
#FDF6E3,#EEE8D5,#93A1A1,#FDF6E3,#EEE8D5,#657B83,#2AA198,#DC322F
Solarized Dark
#073642,#002B36,#B58900,#FDF6E3,#CB4B16,#FDF6E3,#2AA198,#DC322F
class Levenshtein
def initialize(str)
@str = str.downcase
end
def distance(str2)
distances = (0..str2.length.next).to_a
@str.each_char.with_index do |char, i|
distances[0] = i + 1
sub_cost = i
@PetrKaleta
PetrKaleta / Rakefile
Last active August 29, 2015 14:01
Heroku deploy rake tasks with hooks. Demonstrates how to trigger Sidekiq to quiet or terminate via API before deploy
# List of environments and their heroku git remotes (id: 'remote_name')
HEROKU_ENVIRONMENTS = {
staging: 'staging-remote-name',
production: 'production-remote-name'
}
namespace :deploy do
# Create rake tasks to deploy on Heroku environments
# $ rake -T deploy
# rake deploy:production # Deploy to production
@DuoSRX
DuoSRX / sidekiq.go
Last active May 6, 2021 07:54
Enqueue Sidekiq jobs from Go
package main
import (
"crypto/rand"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/garyburd/redigo/redis"
"io"
"time"
module Kernel
alias :old_puts :puts
def puts(val)
old_puts val
old_puts caller.inspect
end
end