Skip to content

Instantly share code, notes, and snippets.

@clouddueling
clouddueling / api.php
Last active December 28, 2015 11:39
Simplifying a rest php api
<?php
class Api
{
public static function is_password($password, $confirm)
{
$v = Validator::make(array(
'password' => $password,
'password_confirmation' => $confirm
), array(
@clouddueling
clouddueling / Music.md
Last active December 28, 2015 09:39
New music to listen to
  • SoulChef
  • Feat. Cise Starr & Akin From Cyne
  • Danny Breaks
@clouddueling
clouddueling / gist:7406092
Created November 11, 2013 00:54
popover directive incomplete
// NOTE Popover
.directive('popover', ['$document', '$http', '$compile', function($document, $http, $compile) {
return function(scope, element, attrs) {
var popoverId = Math.floor(Math.random() * 10000000000),
popoverTitle = attrs.popoverTitle,
popoverPlacement = attrs.popoverPlacement || "top"
$http.get(attrs.popover).success(function(data) {
createPopover(data);
});
@clouddueling
clouddueling / fabricDirective.js
Created October 27, 2013 15:45
FabricJS Zoom
scope.zoomIn = function() {
// TODO limit the max canvas zoom in
canvasScale = canvasScale * SCALE_FACTOR;
canvas.setHeight(canvas.getHeight() * SCALE_FACTOR);
canvas.setWidth(canvas.getWidth() * SCALE_FACTOR);
var objects = canvas.getObjects();
for (var i in objects) {
var scaleX = objects[i].scaleX;
@clouddueling
clouddueling / gist:7085656
Created October 21, 2013 15:19
csv splitting controller
<?php
class Test_Controller extends Base_Controller
{
public function get_index()
{
try {
$s = extend(array(
), sr());
services.factory('Wizard', [function(){
var wizardService = {},
steps = [],
step = 0,
finishLabel = "Finish";
wizardService.isFirstStep = function() {
return step === 0;
};
@clouddueling
clouddueling / www.js
Created October 8, 2013 04:32
$http exposed for easy customization
services.factory('$www', function($http){
function encodeObject(obj) {
var str = "";
for(var p in obj) {
switch(typeof obj[p]) {
case 'boolean' :
str += p + '=' + parseInt(obj[p]) + "&";
break;
case 'number' :
@clouddueling
clouddueling / app.js
Created October 8, 2013 04:23
Show a loading indicator angular js for ajax
app.config(function($routeProvider, $httpProvider) {
var numLoadings = 0,
loadingScreen = $('.processing');
$httpProvider.interceptors.push(function() {
return {
request: function(config) {
++numLoadings;
loadingScreen.show();
@clouddueling
clouddueling / html.php
Last active December 24, 2015 23:09
force load js and css with auto versioning
// Concept
public static function auto_version($url)
{
$file = $_SERVER['DOCUMENT_ROOT'] . '/' . $url;
if(! is_file($file))
return $url;
$mtime = filemtime($file);
return preg_replace('{\\.([^./]+)$}', ".$mtime.\$1", URL::to_asset($url));
@clouddueling
clouddueling / .htaccess
Created October 7, 2013 23:50
Auto version js and css
<IfModule mod_rewrite.c>
RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L]
</IfModule>