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
defmodule GCM.Pusher do | |
use GenStage | |
# The maximum number of requests Firebase allows at once per XMPP connection | |
@max_demand 100 | |
defstruct [ | |
:producer, | |
:producer_from, | |
:fcm_conn_pid, | |
:pending_requests, |
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
defmodule GCM.PushCollector do | |
use GenStage | |
# Client | |
def push(pid, push_requests) do | |
GenServer.cast(pid, {:push, push_requests}) | |
end | |
# 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
Step 5 : ADD server.xml /usr/share/tomcat6/conf/server.xml | |
Error build: mkdir /var/lib/docker/containers/8b2e01ff4bece7456daaa37ad3754cc432269c68fbff0fdc9d563dfbb6cce79e/rootfs/usr/share/tomcat6/conf: file exists | |
mkdir /var/lib/docker/containers/8b2e01ff4bece7456daaa37ad3754cc432269c68fbff0fdc9d563dfbb6cce79e/rootfs/usr/share/tomcat6/conf: file exists |
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
irb(main):018:0> a = [] | |
=> [] | |
irb(main):019:0> a << 3 | |
=> [3] | |
irb(main):020:0> a | |
=> [3] | |
irb(main):021:0> b = a | |
=> [3] | |
irb(main):022:0> b << 4 | |
=> [3, 4] |
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 login() { | |
var email = $('#user_email').val(); | |
var password = $('#user_password').val(); | |
var data = {remote: true, commit: "Sign in", utf8: "✓", | |
user: {remember_me: 1, password: password, email: email}}; | |
$.post('/users/sign_in.json', data, function(resp) { | |
if(resp.success) { | |
// process success case | |
} else { | |
// let the user know they failed authentication |
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
%form | |
= label :user, :email, "Email" | |
= text_field :user, :email | |
= label :user, :password | |
= password_field :user, :password | |
%input{:type => "submit", :value => "Sign in"} |
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
class SessionsController < Devise::SessionsController | |
def create | |
resource = warden.authenticate!(:scope => resource_name, :recall => :failure) | |
return sign_in_and_redirect(resource_name, resource) | |
end | |
def sign_in_and_redirect(resource_or_scope, resource=nil) | |
scope = Devise::Mapping.find_scope!(resource_or_scope) | |
resource ||= resource_or_scope |
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
require 'addressable/uri' | |
require 'net/http' | |
@uri = Addressable::URI.parse("http://sub_domain.host.com") | |
@response = Net::HTTP.get_response(@uri) | |
puts @response.body |
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
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); | |
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); | |
...initialize Toplink... | |
Thread.currentThread.setContextClassLoader(oldLoader); |
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
[:xs:schema {:xmlns:xs "http://www.w3.org/2001/XMLSchema"} | |
[:ordered-list! {:name "own3dreply"} | |
[:ordered-list! {:name "liveEvent"} | |
[:restricted! {:name "isLive" :base "xs:string"} [:xs:pattern {:value "true|false"}]] | |
[:xs:element {:name "liveViewers" :type "xs:integer"}]]]] |
NewerOlder