Skip to content

Instantly share code, notes, and snippets.

@domdoescode
domdoescode / symfony2-git-boilerplate.sh
Created May 30, 2011 21:21
Creating a Symfony2 project, git init, and adding html5-boilerplate default awesome (in twig format)
#!/bin/bash
SYMFONY="Symfony_Standard_Vendors_2.0.0BETA3.tgz"
APPLICATION_ROOT="/var/www"
REMOTE_IP="127.0.0.1"
DB_HOST="localhost"
DB_DRIVER="pdo_pgsql"
DB_USER="test"
DB_PASSWORD="test"
echo "Please enter the company name and project name (in the format CompanyName ProjectName)"
@domdoescode
domdoescode / gist:2703752
Created May 15, 2012 17:59
Re-installing ElasticSearch on Ubuntu 10.04
cd ~
sudo rm -Rf /usr/local/share/elasticsearch
sudo /usr/local/share/elasticsearch/bin/service/elasticsearch remove
sudo rm /usr/local/bin/rcelasticsearch
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.3.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@domdoescode
domdoescode / AbstractRememberMeServices.php
Created June 18, 2012 12:10
Changes to Remember Me service for Symfony 2.0.7, dealing with multiple authentication providers
<?php
namespace Symfony\Component\Security\Http\RememberMe;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
var stylus = require('stylus')
, nib = require('nib')
, uglify = require('uglifyjs')
function processStylus(input, cb) {
fs.readFile(input.src, function (err, data) {
if (err) return cb(err)
@domdoescode
domdoescode / mobile.php
Created November 12, 2012 13:31
Stupidly basic mobile detection =\
<?php
$mobileType = new stdClass();
//Detect special conditions devices
$mobileType->iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$mobileType->iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$mobileType->iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
if(stripos($_SERVER['HTTP_USER_AGENT'],"Android") && stripos($_SERVER['HTTP_USER_AGENT'],"mobile")) {
$mobileType->android = true;
} elseif (stripos($_SERVER['HTTP_USER_AGENT'],"Android")){
$mobileType->android = false;
if i % 2 === 0
- var liClass = 'grid.grid--slim'
else
- var liClass = 'grid.grid--slim grid--reversed'
@domdoescode
domdoescode / new_gist_file
Created June 17, 2013 17:45
Clock Development Setup - Mac OsX
# Stop if something fails
set -e
# Install the latest stable nave the node.js environment switcher Node.js
sudo sh -c 'curl -fsSL https://raw.github.com/isaacs/nave/master/nave.sh > /usr/local/bin/nave && chmod ugo+x /usr/local/bin/nave'
# Install a global node.js
nave usemain stable
# Is xcode needed?
{
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"default_line_ending": "unix",
"dictionary": "Packages/Language - English/en_GB.dic",
"flatland_square_tabs": true,
"font_size": 8,
"highlight_modified_tabs": true,
"ignored_packages":
[
],
@domdoescode
domdoescode / asmr.md
Last active December 22, 2015 23:59
App/Server Monitoring Requirements

App/Server Monitoring Requirements

One issue we're having at the moment is analysing traffic for various virtual hosts (in both Apache and Nginx). A combination of scripting and munin has proven OK, but not ideal. As we're on a cloud infrastructure, working out where traffic is coming from and what specifically is causing it is key.

Our alert and support processes are also currently being reworked; insight into server metrics is useful, and alerts based specifically on certain criteria is a must. Nagios has proven useful for alerts but the overheads in setting it up for each server/service is too much for our small team.

A dream scenario would be a dashboard of servers and services with a basic view of status (OK, warning, critical) that we can have in our office

The main problem we have is setting this infrastructure up; although most of this is achievable, we're looking for any SaaS that can provide this level of insight out of the box. Possibly a pipe-dream, but worth asking around!

@domdoescode
domdoescode / one.js
Created November 19, 2013 14:59
Which is better and why?
module.exports = function () {
function myFunction(callback) {
return callback()
}
return {
myFunction: myFunction
}
}