Skip to content

Instantly share code, notes, and snippets.

@boneskull
boneskull / angular-ui-0.3.1.js
Created August 7, 2013 21:48
cobbled together uiSelect2 to work with ngOptions
/**
* Enhanced Select2 Dropmenus
*
* @AJAX Mode - When in this mode, your value will be an object (or array of objects) of the data used by Select2
* This change is so that you do not have to do an additional query yourself on top of Select2's own query
* @params [options] {object} The configuration options passed to $.fn.select2(). Refer to the documentation
*/
angular.module('ui.directives').directive('uiSelect2', ['ui.config', '$timeout', '$parse', function (uiConfig, $timeout, $parse) {
var options = {};
if (uiConfig.select2) {
@ZaneA
ZaneA / filters.js
Created June 6, 2013 06:55
A couple of filters for AngularJS.
app.filter('escape', function () {
return function (text) {
if (!text) return '';
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
});
app.filter('linkify', function () {
var domainRegexp = /(https?|ftp):\/\/(.*)/;
@clouddueling
clouddueling / controller.php
Last active December 17, 2015 17:39
Enable API like get requests on single objects user/1 /laravel/routing/controller.php public static function call around line 132
// For convenience we will set the current controller and action on the
// Request's route instance so they can be easily accessed from the
// application. This is sometimes useful for dynamic situations.
if ( ! is_null($route = Request::route())) {
$route->controller = $name;
if (is_numeric($method)) {
$parameters = array(
'id' => $method,
);
@clouddueling
clouddueling / index.html
Last active December 17, 2015 05:49
Twitter Bootstrap confirm popover. This makes a really clean and visually easy confirm popover. http://screencloud.net/v/6x6G
<span
class='btn btn-success'
data-title='Confirm order and use selected payment method?'
data-popover-confirm='Cardonfile.purchase()'>
Confirm and Purchase
</span>
@clouddueling
clouddueling / angular-ui.min.js
Created April 3, 2013 03:03
X Editable for Bootstrap + Angular UI
/*
MIT License, http://www.opensource.org/licenses/MIT
*/
angular.module("ui.config",[]).value("ui.config",{});angular.module("ui.filters",["ui.config"]);angular.module("ui.directives",["ui.config"]);angular.module("ui",["ui.filters","ui.directives","ui.config"]);
angular.module("ui.directives").directive("uiAnimate",["ui.config","$timeout",function(uiConfig,$timeout){var options={};if(angular.isString(uiConfig.animate))options["class"]=uiConfig.animate;else if(uiConfig.animate)options=uiConfig.animate;return{restrict:"A",link:function($scope,element,attrs){var opts={};if(attrs.uiAnimate){opts=$scope.$eval(attrs.uiAnimate);if(angular.isString(opts))opts={"class":opts}}opts=angular.extend({"class":"ui-animate"},options,opts);element.addClass(opts["class"]);
$timeout(function(){element.removeClass(opts["class"])},20,false)}}}]);
angular.module("ui.directives").directive("uiCalendar",["ui.config","$parse",function(uiConfig,$parse){uiConfig.uiCalendar=uiConfig.uiCalendar||{};return{require:"ngModel",restrict:"A"
@hugomrdias
hugomrdias / start.php
Last active December 14, 2015 23:59
Damnit for Laravel 3
/**
* Thanks to @philsturgeon for pointing this package
* and Filipe Dobreira "https://github.com/filp" for creating it ^^
* Github : https://github.com/filp/whoops
* How to:
* Step 1 : Setup composer for Laravel 3
* Step 2 : Add this code to your application/start.php or anywhere u like
* as long its after laravel registers its own error handlers
* so NOT in : index.php, paths.php or laravel/**
*
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@DragonI
DragonI / laravel-javascript-cookies.markdown
Last active March 30, 2018 04:58
hack to access / set cookies created in JavaScript from Laravel 3.2

##Objective

Add RESS for conditional content based on screen size. Accomplished by creating a JavaScript cookie

##Problem

When a cookie is set via JavaScript, Laravel's Cookie can't read the cookie. It doesn't work because there is no httpOnly option in Laravel. Symfony cookie does have httpOnly option but it defaults to TRUE. httpOnly has to be set to FALSE in order to access cookies from the browser. See issues:

<div class='row-fluid'>
<div class='span12'>
<div data-toggle-name='record_id' value='Hank Williams' class='btn btn-input btn-large'>
Hank Williams
</div>
<div data-toggle-name='record_id' value='Cee Lo Green' class='btn btn-input btn-large'>
Cee Lo Green
</div>
<input type='hidden' name='record_id' value='0'>
/*
Note the white space in the $page variable.
$page is set somewhere up here and is being concatenated upon.
These units are in bytes.
Sourced from: http://stackoverflow.com/questions/2192657/how-to-determine-the-memory-footprint-size-of-a-variable
*/
// WITHOUT WHITE SPACE: http://screencloud.net/img/screenshots/e5c9b31c4b20021082c22a551fca903c.png
$start_memory = memory_get_usage();