Skip to content

Instantly share code, notes, and snippets.

View jasonmccallister's full-sized avatar

Jason McCallister jasonmccallister

View GitHub Profile
<?php
/**
* Gets the HTTP status code for the given URL.
*
* @param string $url The URL to check.
* @return int
*/
function url_http_status($url) {
$ch = curl_init($url);
@jasonmccallister
jasonmccallister / config.rb
Created July 31, 2015 20:14
compass configuration
# INSTALLATION
# 1. gem install compass-notify
# 2. bower install
# 3. compass watch -e production // or developement
# Require any additional compass plugins here.
require 'compass-notify'
add_import_path "resources/bower_components/foundation/scss"
@bixu
bixu / ruby-2.0.0-p0 on smartos
Last active December 15, 2015 20:09
build ruby-2.0.0-p0 on smartos / illumos, including commonly-used libs/headers, etc - tested on smartos_bas64_1.9.1
## curl the raw version of this gist like this:
## curl -s -L https://gist.github.com/bixu/5316445/raw/[revision]/ruby-2.0.0-p0+on+smartos | bash
pkgin -y install build-essential libyaml readline libxml2 libxslt postgresql92-client
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
@boboldehampsink
boboldehampsink / AssetUploadPlugin.php
Last active December 26, 2015 20:49
Enable this plugin to connect <input type="file" name="fields[yourField]" /> as asset to yourField
<?php
namespace Craft;
class AssetUploadPlugin extends BasePlugin
{
function getName()
{
return Craft::t('Upload assets on the front-end');
}
@jflefebvre
jflefebvre / TwigTimer.php
Created April 9, 2015 20:11
Twig Filter to measure execution time
<?php
namespace MyApp\Helpers;
class TwigTimer extends \Twig_Extension {
protected $total_time = array();
protected $previous_time = array();
/**
@dhrrgn
dhrrgn / install.sh
Last active August 24, 2018 13:06
Setting up Selenium as a Service in OS X
#!/usr/bin/env bash
if [ ! -d /usr/lib/selenium/ ]; then
sudo mkdir /usr/lib/selenium/
fi
if [ ! -f /usr/lib/selenium/selenium-server-standalone-2.41.0.jar ]; then
sudo curl -o /usr/lib/selenium/selenium-server-standalone-2.41.0.jar http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar
fi
@selvinortiz
selvinortiz / craftplugintesting.md
Last active September 13, 2018 18:23
Unit Testing for Craft Plugins

Unit Testing for Craft Plugins

Writing unit tests for your craft plugin has not been straight forward out of the gate but P&T is taking steps to fully integrate unit testing and have already added the basic necessities to do so.

Assumed Directory Structure


@craft = /path/to/site/craft
@craftTests = @craft/app/tests
@mvrhov
mvrhov / minimum.conf
Created April 13, 2011 08:33
nginx über config
server {
listen 80;
server_name <your.site.com>;
root /var/www/vhosts/<your.site.com>/site/www/;
#site root is redirected to the app boot script
location = / {
try_files @site @site;
}
docker run -d \
--restart=always \
-p 33060:3306 \
-e MYSQL_ROOT_PASSWORD=root \
-v ~/docker/volumes/mysql:/var/lib/mysql \
--name mysql-5.7 \
mysql:5.7 \
--sql-mode="NO_ENGINE_SUBSTITUTION"
@jasonmccallister
jasonmccallister / main.go
Created November 2, 2020 01:27
Changing directories with Go exec.command
package main
import (
"flag"
"log"
"os"
"os/exec"
)
func main() {