This file contains hidden or 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
// entry: app/javascript/packs/calendar.js | |
require('calendar') or import 'calendar'; // in es6 world | |
// 1. Angular app | |
// Main index file that loads all dependent code and bootstraps module to DOM if required | |
require('./components/calendar.js') or import './components/calendar.js'; | |
require('./models/calendar.js') or import './models/calendar.js'; | |
// app/javascript/calendar/index.js | |
// Modular js much like rails app folder |
This file contains hidden or 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
source 'https://rubygems.org' | |
ruby '2.2.6' | |
gem 'rails', '~> 5.1.x' | |
gem 'sprockets', '~> 4.x' |
This file contains hidden or 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
/* global window SE */ | |
import $ from 'jquery'; | |
export default class StackExchange { | |
constructor() { | |
$.getScript(window.STACKOVERFLOW_JS_SDK_URL, (data, textStatus) => { | |
if (textStatus === 'success') { | |
SE.init({ | |
clientId: `${window.STACKOVERFLOW_CLIENT_ID}`, |
This file contains hidden or 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
/* global window IN Routes */ | |
import $ from 'jquery'; | |
export default class Linkedin { | |
constructor() { | |
$.getScript(window.LINKEDIN_JS_SDK_URL, (data, textStatus) => { | |
if (textStatus === 'success') { | |
IN.init({ | |
api_key: window.LINKEDIN_CLIENT_ID, |
This file contains hidden or 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
/* global window document gapi */ | |
import $ from 'jquery'; | |
export default class Google { | |
constructor() { | |
$.getScript(window.GOOGLE_JS_SDK_URL, (data, textStatus) => { | |
if (textStatus === 'success' && gapi !== undefined) { | |
gapi.load('client:auth2', this.initClient); | |
} |
This file contains hidden or 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
/* global window */ | |
const popup = (url) => { | |
const windowArea = { | |
width: Math.floor(window.outerWidth * 0.8), | |
height: Math.floor(window.outerHeight * 0.5), | |
}; | |
if (windowArea.width < 1000) { windowArea.width = 1000; } | |
if (windowArea.height < 630) { windowArea.height = 630; } |
This file contains hidden or 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 SinatraGraphqlErb < Sinatra::Base | |
set public_folder: 'public', static: true | |
use Rack::Session::Cookie, secret: 'super_secret_client_key' | |
use Rack::Protection | |
use Rack::Protection::RemoteReferrer | |
use Sass::Plugin::Rack | |
private | |
def query(definition, variables = {}) |
This file contains hidden or 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
IndexQuery = API::Client.parse <<-'GRAPHQL' | |
query { | |
root { | |
id, | |
tags, | |
posts(first: 10) { | |
edges { | |
node { | |
id, | |
title, |
This file contains hidden or 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
module API | |
HTTPAdapter = GraphQL::Client::HTTP.new(ENV['API_URL']) | |
# | |
# Pass block to send auth token | |
# def headers(context) | |
# { | |
# "Authorization" => "Bearer #{ENV['ACCESS_TOKEN']}" | |
# } | |
# end |
This file contains hidden or 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
/* | |
Mount and Unmount react components at nodes | |
*/ | |
/* global Turbolinks, ReactHelper */ | |
import ReactDOM from 'react-dom'; | |
import Relay from 'react-relay'; | |
import React from 'react'; |