Skip to content

Instantly share code, notes, and snippets.

@clouddueling
clouddueling / sanitize.php
Created October 6, 2013 03:43
allow vimeo and youtube iframes in HTMLPurifier
/**
* Sanitize string input
* @param string $dirty_html
* @return string
*/
public static function purify( $dirty_html )
{
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo
@clouddueling
clouddueling / card.js
Created October 6, 2013 01:34
Example REST service for angularjs
services.factory('Card', function($http, $www){
return {
create: function(inputs) {
return $http.post('/api/v1/card', inputs);
},
delete: function(id) {
return $http.delete('/api/v1/card/' + id);
},
update: function(id, inputs) {
return $http.put('/api/v1/card/' + id, inputs);
/**
* 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) {
@clouddueling
clouddueling / multi.js
Created September 22, 2013 21:10
detecting multimedia
$['Redactor']['fn']['formatLinkify'] = function (protocol, convertLinks, convertImageLinks, convertVideoLinks) {
var url1 = /(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,
url2 = /(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,
urlImage = /(https?:\/\/.*\.(?:png|jpg|jpeg|gif))/gi,
urlYoutube = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,
urlVimeo = /http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/;
var childNodes = (this['$editor'] ? this['$editor']['get'](0) : this)['childNodes'],
i = childNodes['length'];
while (i--) {
var n = childNodes[i];
@clouddueling
clouddueling / system.md
Created September 20, 2013 18:49
system vs system center

The products "due date" are set from employee goals. The product system assignments are based on the employee who has a goal set for them. The RMC needs time based systems to ensure a system is completed based on patients need or schedule. They also need assign a user b/c a patient needs all job positions to happen with their experience.

@clouddueling
clouddueling / menuDrag.js
Created September 19, 2013 01:09
menu drag
myapp.directive("menuDrag", function () {
return{
restrict: "A",
link: function (scope, element, attrs) {
var item = $(".draggable").draggable(
{
snap: true,
revert: false,
// scope:".dropable"
@clouddueling
clouddueling / gist:6562352
Created September 14, 2013 14:11
php async code laravel
This waits for the CURL request to push to firebase but no one is waiting for it.
####application/controllers/firebase.php
<?php
class Firebase_Controller extends Base_Controller
{
public function post_index()
{
try {
div.colorPicker-picker {
background: url(arrow.gif) no-repeat bottom right;
border-radius: 5px;
border: 1px solid #ddd;
cursor: pointer;
height: 24px;
line-height: 16px;
padding: 0 !important;
width: 100px;
}
/**
* Really Simple Color Picker in jQuery
*
* Licensed under the MIT (MIT-LICENSE.txt) licenses.
*
* Copyright (c) 2008-2012
* Lakshan Perera (www.laktek.com) & Daniel Lacy (daniellacy.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@clouddueling
clouddueling / question.md
Created September 9, 2013 21:19
Temporarily isolate a small jquery app in angularjs?

How can I run an isolated large jquery script inside of an AngularJS app?

It is completely self contained and loads via ajax requests.

I'm the only developer at this time and temporarily until I can completely finish our conversion from jQuery I have a large jquery "app" (more like script) than must be working in the meantime.

Using AngularJS 1.0.7 It's 1023 lines

var s,