Skip to content

Instantly share code, notes, and snippets.

View marbemac's full-sized avatar

Marc MacLeod marbemac

View GitHub Profile
<?php
namespace Limelight\JanrainBundle\Security\User\Provider;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
@marbemac
marbemac / nokogiri
Created September 26, 2011 16:57 — forked from fabioyamate/nokogiri
nokogiri installation from libxml2 and libxslt macosx
# using rvm with ruby-1.9.2-p290
# latest version 2.7.8 2011-09-20
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.8
make
sudo make install
START a=node(1), b=node(2), c=node(3), d=node(4)
MATCH pa=shortestPath( a<-[:RELATED|TYPE_OF]->b ), pb=shortestPath( b<-[:RELATED|TYPE_OF]->c ) # etc ... Do I really need to make all of these combos...?
RETURN (SUM(affinities along the paths) / length(pa/pb/etc)) as association_strength # No idea how to do this part. I need to sum the "weight" property of the affinity connections along the paths discovered in the match clause, and then divide that sum by the length of the path
ORDER BY association_strength desc
@marbemac
marbemac / StackScript.sh
Last active December 24, 2015 21:09 — forked from visnup/StackScript.sh
use coffee, remove knockout public key
#!/bin/bash
# <UDF name="user_name" label="Unprivileged user account name" example="This is the account that you will be using to log in or deploy (deployer)." default="deployer" optional="false" />
# <UDF name="user_password" label="Unprivileged user password" optional="false" />
# <UDF name="user_sshkey" label="Public Key for user" default="" example="Recommended method of authentication. It is more secure than password log in." optional="false" />
# <UDF name="user_shell" label="Shell" oneof="/bin/zsh,/bin/bash" default="/bin/bash" />
# <UDF name="sys_hostname" label="System hostname" default="myvps" example="Name of your server, i.e. linode1." optional="false" />
# <UDF name="sys_private_ip" Label="Private IP" default="" example="Configure network card to listen on this Private IP (if enabled in Linode/Remote Access settings tab). See http://library.linode.com/networking/configuring-static-ip-interfaces" optional="false" />
USER_GROUPS=sudo
@marbemac
marbemac / Node Linode Stackscript
Created October 11, 2013 01:34
Linode stackscript to setup node, deployer user, git, private networking, basic security, coffee script, and pm2 for node process management.
#!/bin/bash
# <UDF name="user_name" label="Unprivileged user account name" example="This is the account that you will be using to log in or deploy (deployer)." default="deployer" optional="false" />
# <UDF name="user_password" label="Unprivileged user password" optional="false" />
# <UDF name="user_sshkey" label="Public Key for user" default="" example="Recommended method of authentication. It is more secure than password log in." optional="false" />
# <UDF name="user_shell" label="Shell" oneof="/bin/zsh,/bin/bash" default="/bin/bash" />
# <UDF name="sys_hostname" label="System hostname" default="myvps" example="Name of your server, i.e. linode1." optional="false" />
# <UDF name="sys_private_ip" Label="Private IP" default="" example="Configure network card to listen on this Private IP (if enabled in Linode/Remote Access settings tab). See http://library.linode.com/networking/configuring-static-ip-interfaces" optional="false" />
USER_GROUPS=sudo
@marbemac
marbemac / gist:06c5040e4d71694f07b3
Created September 8, 2014 21:08
Ember.js custom serializer for consistent JSON root
// API return format is as so:
// {
// data: [
// {
// name: 'foo'
// },
// {
// name: 'bar'
// }
// ]
@marbemac
marbemac / actions.js
Last active August 29, 2015 14:17
A query mixin for Baobab, supporting local and remote fetching, error handling, and loading handling.
// actions.js provides functions to fetch
// remote data and store it in the tree
// these remote functions should return
// promises
require('es6-promise').polyfill();
var stateTree = require('./stateTree'),
PostModel = require('./post'),
fetch = require('isomorphic-fetch'),
@marbemac
marbemac / gist:27ee149aa5a50ce82823
Created July 12, 2015 18:08
Signals implementation
const runAction = (name, action, commonArgs, args) => {
console.log(`signals:${name}:${action.name}`, {action: action, commonArgs: commonArgs, args: args})
try {
return action(commonArgs, args)
} catch(e) {
console.error(`Error running ${action.name} action for the ${name} signal.`,
{action: action, err: e, commonArgs: commonArgs, args: args})
return Promise.reject(e)
}
@marbemac
marbemac / main.go
Created September 8, 2015 06:22
Simple go proxy, copying body
package main
import (
"bytes"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
"net/url"
)
@marbemac
marbemac / main.js
Created September 8, 2015 06:25
Simple node server returning file
// Load the http module to create an http server.
var http = require('http');
var largeResponse = require('./large_response.json')
largeResponse = JSON.stringify(largeResponse)
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "application/json"});