Skip to content

Instantly share code, notes, and snippets.

@rwitchell
rwitchell / FacebookConnectController.php
Created May 23, 2016 14:28
oauth2-client-bundle install example
<?php
namespace Comp\AppBundle\Controller;
use Comp\AppBundle\Entity\User;
use Comp\AppBundle\Form\FacebookRegistrationType;
use League\OAuth2\Client\Provider\FacebookUser;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
@juampynr
juampynr / README.md
Last active August 6, 2019 08:46
Sample Guzzle 6 request to Drupal 8 using OAuth 1

This script helps you to test OAuth-signed requests against Drupal 8.

First, make sure that Drupal has been configured by following the steps at https://www.drupal.org/node/2110825. Then install this script with these steps:

  1. Clone this gist.
  2. Run composer.install.
  3. Open oauth_request.php and fill out your consumer_key and consumer_secret. Then Adjust base_uri.
  4. Execute the script with php oauth_request.php.
---
# test SSH agent forwarding
- shell: echo "Client= [$SSH_CLIENT] Sock= [$SSH_AUTH_SOCK]"
sudo: no
register: myecho
- debug: msg="{{myecho.stdout}}"
- shell: ssh-add -l
sudo: no
register: myecho
- debug: msg="{{myecho.stdout}}"
@IslandUsurper
IslandUsurper / gist:12723643dddc9315ff71
Created March 10, 2015 18:50
Behat Step to select an autocomplete suggestion
<?php
use Behat\Mink\Extension\ElementNotFoundException;
use Drupal\DrupalExtension\Context\DrupalContext;
class FeatureContext extends DrupalContext {
/**
* @When I select the first autocomplete option for :prefix on the :field field
*/
@acavanagh
acavanagh / gulpfile.js
Created October 8, 2014 16:39
Gulp file to run phpunit and behat tests
//gulpfile.js
var gulp = require('gulp');
var beep = require('beepbeep');
var sys = require('sys');
var exec = require('child_process').exec;
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var onError = function(err) {
beep([1000, 1000, 1000]);
@rsbohn
rsbohn / gist.rb
Last active August 29, 2015 14:05
xiki gist menu
# save to ~/menu
# then run using "gist"
require "rest-client"
require "json"
class Gist
Github = RestClient::Resource.new "https://api.github.com"
DefaultMenu =
" - bb1f4fffaccbd30125b9
- user/rsbohn/
@conradev
conradev / stars.py
Last active December 11, 2016 14:32
Command line utility to print out a user's Github stars
#!/usr/bin/env python
# coding: utf8
import sys, urllib2, json
def width():
def ioctl_GWINSZ(fd):
try:
import fcntl, termios, struct, os
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
@tPl0ch
tPl0ch / CommandContext.php
Last active August 18, 2023 11:18
A CommandContext for Behat tests of Symfony Console Commands
<?php
namespace MFB\Behat\Subcontext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
@backus
backus / explain.sh
Created August 30, 2013 08:13
command line explain for http://explainshell.com
#!/bin/bash
cmd="$(cut -d ' ' -f 1 <<< "$@" )";
args="$(cut -d ' ' -f 2- <<< "$@" )";
url="http://explainshell.com/explain/$cmd?args=$args"
explanation="$(curl -s $url | grep '<pre' | sed -E 's/<\/?[a-z]+(\ [a-z]+=\"[a-z0-9]+\")*>//g' | sed -E 's/^\ +//g')"
echo "$explanation"

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption