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 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 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 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 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 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 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
// Note: You must restart bin/webpack-watcher for changes to take effect | |
var webpack = require('webpack') | |
var merge = require('webpack-merge') | |
var sharedConfig = require('./shared.js') | |
module.exports = merge(sharedConfig.config, { | |
devtool: 'sourcemap', |
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
// Note: You must restart bin/webpack-watcher for changes to take effect | |
var webpack = require('webpack') | |
var merge = require('webpack-merge') | |
var sharedConfig = require('./shared.js') | |
module.exports = merge(sharedConfig.config, { | |
output: { filename: '[name]-[hash].js' }, |
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
// Initialize the counter code when DOM is ready | |
import counter from './counter'; | |
document.addEventListener('DOMContentLoaded', () => { | |
counter.initialize(); | |
}); |
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 or import the counter module | |
import '../counter'; |
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
$grey: #f2f2f2 | |
.counter-wrapper | |
max-width: 500px | |
margin: 100px auto | |
padding: 10px | |
border: 1px solid $grey | |
form |