Skip to content

Instantly share code, notes, and snippets.

@zukasmichael
zukasmichael / app.module.ts
Last active January 30, 2018 20:22
progressive image loading directive for angular 2+ / wrapper background css loads small image while directive loads a big one and adds it on the top
import {ImageloaderDirective} from './directives/imageloader/imageloader.directive';
@NgModule({
...
declarations: [
ImageloaderDirective
],
...
})
@zukasmichael
zukasmichael / background-image.ts
Created January 29, 2018 02:22 — forked from fer-ri/background-image.ts
Background Image Style Directive for Angular 2 and Ionic 2
import {Directive, ElementRef, Input} from '@angular/core';
@Directive({
selector: '[background-image]'
})
export class BackgroundImage {
private el: HTMLElement;
constructor(el: ElementRef) {
this.el = el.nativeElement;
<?php
namespace Acme\App\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Silex\Application;
use Silex\Api\ControllerProviderInterface;
use Acme\Util\Database;
// json request parser
$app->before(function ($request) {
if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) {
$data = json_decode($request->getContent(), true);
$request->request->replace(is_array($data) ? $data : []);
}
});
db.getCollection('attrib_cd').find({}).forEach(function(doc) {
doc['qid'] = doc["0"];
delete doc["0"];
db.getCollection('attrib_cd').save(doc);
});
/**
* Threw together by Richard Willis - badsyntax.co
*/
var service = new google.maps.places.AutocompleteService();
var geocoder = new google.maps.Geocoder();
$(field).typeahead({
source: function(query, process) {
service.getPlacePredictions({ input: query }, function(predictions, status) {