Skip to content

Instantly share code, notes, and snippets.

<?php
use Aws\S3\S3Client;
use Gregwar\Image\Image;
use Gregwar\Image\GarbageCollect;
class Image_Controller extends Base_Controller
{
public function get_index()
{
@clouddueling
clouddueling / bookmarklet.js
Created February 6, 2014 21:58
Add to a bookmark as the url and click the bookmark.
javascript: (function () { var root = $(document.getElementsByTagName('body')); var watchers = []; var f = function (element) { if (element.data().hasOwnProperty('$scope')) { angular.forEach(element.data().$scope.$$watchers, function (watcher) { watchers.push(watcher); }); } angular.forEach(element.children(), function (childElement) { f($(childElement)); }); }; f(root); console.log(watchers.length);})();
'use strict';
angular.module('colorpicker.module', [])
.factory('Helper', function () {
return {
closestSlider: function (elem) {
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
if (matchesSelector.bind(elem)('I')) {
return elem.parentNode;
}
@clouddueling
clouddueling / PermissionsTest.php
Last active August 29, 2015 13:57
Permissions
<?php
class PermissionsTest extends PHPUnit_Framework_TestCase
{
public $user;
public function setUp()
{
$this->user = User::create([
'permissions' => ''
@clouddueling
clouddueling / fabric.tpl.html
Created April 20, 2014 00:07
Fabric controls
<div ng-controller="ImagesCtrl">
<div class="form-horizontal">
<div style="position: relative;">
<div ng-if="Fabric.isLoading" class="image-loading">
<div class="loading-indicator"></div>
</div>
@clouddueling
clouddueling / finderSpec.js
Created April 22, 2014 18:04
Testing a service, controller, and filter using stub for service
describe('Profile | Clipboard | Finder |', function() {
beforeEach(module('profile.clipboard.finder'));
beforeEach(module('ui.router'));
describe('ClipboardFinderCtrl |', function() {
var ctrl, scope, httpBackend, finder;
beforeEach(inject(function($rootScope, $controller, Finder, $httpBackend) {
scope = $rootScope.$new();
scope.main = {};
@clouddueling
clouddueling / ServiceExample.js
Last active August 29, 2015 14:00
A service you can create easily instances of and test.
// NOTE: I ripped this out of my app so it's missing some context. Just observe the methodology used.
// This was also incredibly simple to reach 100% testing across the board.
(function() {
'use strict';
angular.module('module.finder', [])
.controller('ModuleFinderCtrl', ['$scope', 'Finder', function($scope, Finder) {
$scope.finder = new Finder();
⚡ grunt release
Running "clean:0" (clean) task
Cleaning public/dist/js...OK
Running "uglify:vendor" (uglify) task
File public/dist/js/vendor.js created.
Running "uglify:profile" (uglify) task
File public/dist/js/profile.js created.
<?php namespace Modules\Api;
use Validator;
use User;
use Input;
use Response;
use Sanitize;
class Api
{
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
02installVendors:
command: /usr/bin/composer.phar install --no-dev
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root