Skip to content

Instantly share code, notes, and snippets.

View assertchris's full-sized avatar

Christopher Pitt assertchris

View GitHub Profile
function fitToScreen(selector) {
var element = document.querySelector(selector);
var width = element.offsetWidth;
var height = element.offsetHeight;
var top = "-" + (height / 2) + "px";
var left = "-" + (width / 2) + "px";
var ratio = getRatio(width, height);
<?php
$env = $app->detectEnvironment(function() {
// detect environment here
return "local";
});
<?php
// https://github.com/teepluss/laravel4-theme/blob/master/src/Teepluss/Theme/Theme.php#L714-L750
class IndexController
extends BaseController
{
public function indexAction()
{
$foo = "bar";
<?php
namespace Formativ\Theme;
use Illuminate\Foundation\Application;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
class ThemeServiceProvider
extends ServiceProvider
<?php
namespace Tricks\Providers;
use App;
use Mockery;
use TestCase;
class NavigationServiceProviderTest
extends TestCase
<?php
namespace Tricks\Providers;
use Tricks\Services\Social\Disqus;
use Tricks\Services\Social\Github;
use Illuminate\Support\ServiceProvider;
use Guzzle\Service\Client as GuzzleClient;
use League\OAuth2\Client\Provider\Github as GithubProvider;
@assertchris
assertchris / gist:9728147
Created March 23, 2014 19:11
Ah, namespace resolution.
<?php
namespace Tricks\Services\Upload;
use Mockery;
use TestCase;
$headers = [];
function header($value) {
<?php
@foreach (array_chunk($images->toArray(), 4) as $chunk)
<tr>
@foreach($chunk as $image)
<td><img src="{{ $image["url"] }}"></td>
@endforeach
</tr>
@endforeach
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
❯ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing illuminate/container (v4.2.8)
Loading from cache
- Installing michelf/php-markdown (1.4.1)
Loading from cache