Skip to content

Instantly share code, notes, and snippets.

@rmosolgo
rmosolgo / Gemfile
Last active March 27, 2023 08:38
GraphQL Ruby Subscriptions
source 'https://rubygems.org'
gem "graphql", github: "rmosolgo/graphql-ruby", branch: "subscriptions"
gem "sinatra"
gem "thin"
@kinopyo
kinopyo / Gemfile
Last active December 28, 2018 00:23
Make Turbolinks work with DoubleClick for Publishers(alternative of Google Adsense)
gem 'turbolinks'
gem 'jquery-turbolinks'
resolver = Prismic.link_resolver('master'){ |doc_link| "http:#localhost/#{doc_link.id}" }
serializer = Prismic.html_serializer do |element, html|
if element.is_a?(Prismic::Fragments::StructuredText::Block::Image)
# Don't wrap images in a <p> tag
%(<img src="#{element.url}" alt="#{element.alt}" width="#{element.width}" height="#{element.height}" />)
else
nil
end
end
doc = response.results[0]
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
@pcreux
pcreux / 000_postgresql_fancy_datatypes
Last active March 18, 2022 16:51
Postgresql fancy datatypes with Rails / ActiveRecord. Run it with `rake`!
# Postgresql fancy datatypes!
* array
* hstore (=~ hash)
* json
* jsonb
Philippe Creux - [@pcreux](http://twitter.com/pcreux)
@jakejscott
jakejscott / server.go
Created May 20, 2014 00:53
negroni + httprouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
@peterhellberg
peterhellberg / dualshock3-firmata-leds.go
Created March 30, 2014 18:24
Gobot: Controlling LEDs connected to an Arduino over Firmata using a PS3 DualShock 3 controller.
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot-firmata"
"github.com/hybridgroup/gobot-gpio"
"github.com/hybridgroup/gobot-joystick"
)
class MongoidConnectionMiddleware
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
ensure
clean_connection
end
@bbrowning
bbrowning / TorqueBox on Heroku.md
Last active December 9, 2015 16:19
TorqueBox on Heroku

With Heroku's JRuby support you may have already seen that you can run TorqueBox Lite on Heroku. But, that only gives you the web features of TorqueBox. What about scheduled jobs, backgroundable, messaging, services, and caching?

With a small amount of extra work, you can now run the full TorqueBox (minus STOMP support and clustering) on Heroku as well! I've successfully deployed several test applications, including the example Rails application from our Getting Started Guide which has a scheduled job, a service, and uses backgroundable and messaging.

This example uses TorqueBox 3.0.2, but the instructions may work with other TorqueBox versions.

Steps Required

  1. Create a JRuby application on Heroku, or convert an existing application to JRuby. Make sure your application works on JRuby on Heroku before throwing TorqueBox into the mix.
  2. Add th
@victorbstan
victorbstan / clips.html
Created August 25, 2012 20:34
Angular JS and Rails 3 Infinite Scroll Pagination
<!--
This is the HTML portion of the infinite scroll/pagination with Rails and AngularJS tutorial
Required libraries for the tutorial and indicated as "Important",
together with implementation specific libraries marked as "Optional"
-->
<!DOCTYPE html>
<html>
<title>Clips</title>
<!-- Important -->