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
| // npm install express nunjucks body-parser | |
| const express = require('express'); | |
| const nunjucks = require('nunjucks'); | |
| const body_parser = require('body-parser'); | |
| var app = express(); | |
| nunjucks.configure('views', { | |
| autoescape: true, |
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 MyComponent extends React.Component { | |
| constructor(props) { | |
| // set the default internal state | |
| this.state = { | |
| clicks: 0 | |
| }; | |
| } | |
| componentDidMount() { | |
| this.refs.myComponentDiv.addEventListener('click', this.clickHandler); |
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
| #!/usr/bin/env python | |
| import tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.log | |
| import tornado.web | |
| import tornado.wsgi | |
| import tornado.websocket | |
| class MyWebSocket(tornado.websocket.WebSocketHandler): |
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
| import requests | |
| payload = { | |
| 'cmd': 'authenticate', | |
| 'user': 'hou-user', | |
| 'password': '45453395' | |
| } | |
| r = requests.post('https://securelogin.arubanetworks.com/cgi-bin/login', payload, verify=False) |
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
| def tpl_files (): | |
| tpls = [] | |
| base_dir = os.path.join(settings.BASE_DIR, 'static', 'nac') | |
| for root, dirs, files in os.walk(base_dir): | |
| for file in files: | |
| if file.endswith('.html'): | |
| fullpath = os.path.join(root, file) | |
| relpath = fullpath.replace(base_dir + '/', '').replace('/', '-') | |
| relpath = relpath[:-5] | |
| with open(fullpath, 'r') as fh: |
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
| var gulp = require('gulp'); | |
| var plumber = require('gulp-plumber'); | |
| var concat = require("gulp-concat"); | |
| var less = require('gulp-less'); | |
| var rollup = require('rollup').rollup; | |
| var buble = require('rollup-plugin-buble'); | |
| var resolve = require('rollup-plugin-node-resolve'); | |
| var commonjs = require('rollup-plugin-commonjs'); | |
| var build_tasks = ['build-js', 'build-css']; |
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
| machine: | |
| node: | |
| version: 6.11.0 | |
| dependencies: | |
| pre: | |
| # Install Selenium. | |
| - curl -O http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar | |
| - curl https://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip | gzip -dc > chromedriver | |
| - chmod +x chromedriver |
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
| var chai = require('chai'); | |
| var expect = chai.expect; | |
| var webdriverio = require('webdriverio'); | |
| describe('my webdriverio tests', function() { | |
| this.timeout(60000); | |
| var client; | |
| before(function(){ | |
| client = webdriverio.remote({ desiredCapabilities: {browserName: 'chrome'} }); |
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
| from fabric.api import run, env, sudo, cd, prefix, shell_env | |
| env.hosts = ['45.32.207.111'] | |
| env.user = 'paul' | |
| DIR = '/home/paul/AppFish' | |
| VENV = 'source SECRETS.ENV' | |
| def start (): | |
| with cd(DIR): |
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
| import React, { Component } from 'react'; | |
| class HelloLi extends Component { | |
| handleClick(event, item) { | |
| if (item.selected) { | |
| item.selected = false; | |
| } else { | |
| item.selected = true; | |
| } | |