Skip to content

Instantly share code, notes, and snippets.

View ftdysa's full-sized avatar

Fred Dysart ftdysa

  • Automox
  • Denver, CO
View GitHub Profile
@ftdysa
ftdysa / influxdb.conf
Created April 7, 2017 17:50 — forked from acherunilam/influxdb.conf
Nginx config for InfluxDB HA
http {
client_max_body_size 20M;
upstream influxdb {
server server1:8086;
server server2:8086;
}
upstream relay {
server server1:9096;
server server2:9096;
locations:
nxvl_7hetf84txck7:
location: '~ ^/(js|css|images|fonts)'
gzip_static: on
expires: 30d
add_header: 'Cache-Control public'
add_header: 'Last-Modified ""'
add_header: 'ETag ""'
access_log: off
@ftdysa
ftdysa / SudoListener.php
Created April 8, 2015 19:01
response from controller event
class SudoListener {
public function onKernelController(FilterControllerEvent $event) {
$controller = $event->getController();
$token = $this->tokenStorage->getToken();
if ($token === null || ($user = $token->getUser()) === null) {
return;
}
if (!is_array($controller)) {
# Create a new Token
curl -u 'githubuser' -d '{"note":"Your Application"}' https://api.github.com/authorizations
# It is: "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210"
#{
# "created_at": "2013-01-04T18:00:28Z",
# "app": {
# "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@ftdysa
ftdysa / SuccessHandler.php
Created September 18, 2014 19:51
Custom login success handler
<?php
namespace NationalNet\MynatnetBundle\Security\Authentication\Handler;
use NationalNet\MynatnetBundle\Manager\UserManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
@ftdysa
ftdysa / ghost-api.js
Created September 14, 2014 19:15
Example of accessing ghost's api. Check out core/server/routes/api.js for more routes you can hit.
var querystring = require('querystring');
var http = require('http');
var fs = require('fs');
var requester = require('request');
var postData = querystring.stringify({
grant_type: "password",
username: "your_email",
password: "password",
client_id: "ghost-admin"
@ftdysa
ftdysa / make-tags.js
Created September 14, 2014 03:03
Get all tags for ghost
var config = require('./../../../../config');
var sqlite3 = require('sqlite3');
var dbfile = config.development.database.connection.filename;
var db = new sqlite3.Database(dbfile);
db.serialize(function() {
db.all("select * from tags", function(err, rows) {
console.log(JSON.stringify(rows));
})
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
$builder->add('secretQuestion', 'entity', [
'property' => 'question',
'class' => 'E:SecretQuestion',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('q')->orderBy('q.id', 'ASC');
}
]);