Skip to content

Instantly share code, notes, and snippets.

💭
⚾️ ⚾️ ⚾️

Amir Djavaherian adjavaherian

💭
⚾️ ⚾️ ⚾️
Block or report user

Report or block adjavaherian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View map based haproxy redirects
haproxy.conf:
http-request redirect location %[path,lower,map(/etc/haproxy/redirects-path.map)] code 301 if { path,lower,map(/etc/haproxy/redirects-path.map) -m found }
redirects-path.map:
/help /en/help/help.html
/sitemap /en/sitemap.xml
@fordprefect480
fordprefect480 / bot.js
Last active Feb 18, 2016
A slackbot which retrieves Star Wars articles given a search term.
View bot.js
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______ ______ ______ __ __ __ ______
/\ == \ /\ __ \ /\__ _\ /\ \/ / /\ \ /\__ _\
\ \ __< \ \ \/\ \ \/_/\ \/ \ \ _"-. \ \ \ \/_/\ \/
\ \_____\ \ \_____\ \ \_\ \ \_\ \_\ \ \_\ \ \_\
\/_____/ \/_____/ \/_/ \/_/\/_/ \/_/ \/_/
This is a simple Slack bot built with Botkit. The bot is called 'holocron' and will go get a Star Wars article (from Wookiepedia)
if you mention or direct mention the bot with a search term.
@adjavaherian
adjavaherian / Analytics.jsx
Last active Dec 13, 2017 — forked from fredrick/App-example-test.js
Here's how we have been pre-processing Jest tests for React.js components which require React-Router or Fluxxor.
View Analytics.jsx
//./app/modules/Analytics.jsx
var React = require('react');
var Fluxxor = require('fluxxor');
var FluxMixin = Fluxxor.FluxMixin(React);
var paths = require('../helpers/paths');
var Analytics = React.createClass({
displayName: 'Analytics',
mixins: [FluxMixin],
@fredrick
fredrick / App-example-test.js
Last active Apr 6, 2018
React Router Test Context Helper
View App-example-test.js
var React = require('react/addons'),
TestUtils = React.addons.TestUtils,
TestContext = require('./TestContext'),
App = require('./App.jsx'),
app = TestContext.getRouterComponent(App);
describe('App', function() {
it('has something', function() {
expect(app.getDOMNode().textContent).toContain('something');
});
@jdxcode
jdxcode / boot.js
Last active Oct 24, 2018
zero-downtime node.js app runner
View boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
You can’t perform that action at this time.