Skip to content

Instantly share code, notes, and snippets.

View davorpeic's full-sized avatar
🏠
Working from home

Davor Peic davorpeic

🏠
Working from home
View GitHub Profile
@Repox
Repox / send.php
Created April 12, 2018 06:04
Google API PHP Client - Firebase Cloud Messaging Service v1 example
<?php
/**
* This serves as an example of how to use the Google API PHP Client
* with Firebase Cloud Messaging Service.
*
* The client can be found here:
* https://github.com/google/google-api-php-client
*
* At the time of writing this, there's no Service object for the correct
@ORESoftware
ORESoftware / resize-base64.js
Last active October 13, 2024 17:55
resizing an image on the front-end before sending to a server
// Using this code, we can retrieve an image from a user's filesystem, resize the image, and then upload the image
// to a server using AJAX. Because we use base64 encoding, we can just include the image data as just another string value
// in a JSON payload.
// So we can use AJAX to send the file to a server, which is convenient.
// We have one line of relevant html
// get file in the first place => <input type="file" custom-on-change="onAcqImageFileChange" class="form-control">
@barbietunnie
barbietunnie / stop-mac-apache.sh
Created February 25, 2017 22:42
Stop Default Apache server running on Mac OS Sierra
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Mailchimp;
// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// It's BYOCSS.
// And also, I don't support this at all whatsoever.
;(function(window, document, undefined) {
'use strict';
@jordinebot
jordinebot / .htaccess
Last active November 16, 2023 12:32
Optimized .htaccess for Google PageSpeed Insights
# ########################
# Leverage browser caching
# ########################
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
@01-Scripts
01-Scripts / hook.php
Created August 18, 2015 19:34
Add Post Deploy-Hook as HTTP POST Notification for deployhq.com deploys. Put the following file in the root directory of your project or adjust the path in line 24.
<?PHP
$publicKey = "-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXJcP2N6NtcN26Q8nVaidXOA0w
RxWK2HQTblIaQdGRDjqTvhrSlFuV5N4jz7w/w8uskP20G7ZQ+CkHwIXrWk76KZJn
pdoOHPO6AqRmEFgV5Q6Y1CR77mvnT9O21hTnfzfyyiAdQC2oO8M9/jeLRPTAqmkG
xdQa8iepUz4BwrrHmwIDAQAB
-----END PUBLIC KEY-----";
// Verify integrity of Payload
$result = openssl_verify($_POST['payload'], base64_decode($_POST['signature']), $publicKey);
@sean-hill
sean-hill / Hide Splashscreen in Ionic App
Last active April 16, 2017 17:25
Hide Splashscreen in Ionic App with ngCordova
Hide Splashscreen in Ionic App
@bjornbjorn
bjornbjorn / https redirect
Last active August 29, 2015 14:11
secure http -> https redirect in master config (EE)
/**
* Force HTTPS on prod & staging. This functionality was previously in the .htaccess'es but we moved
* it here to ease multiple environment development.
*/
if(FORCE_HTTPS && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "")){
$redirect_url = filter_var("https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], FILTER_VALIDATE_URL);
if($redirect_url) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect_url");
die();
@jimthedev
jimthedev / 010_resource_files.js
Last active April 2, 2018 06:55
Shell script to automatically copy icons and splash screens in Cordova 3.5 / Ionic Framework
#!/usr/bin/env node
// this file lives at hooks/after_prepare/010_resource_files.js
// It copies my icon and splash screens to the correct location
// so that they will be loaded by Cordova 3.5
//
// This hook copies various resource files
// from our version control system directories
// into the appropriate platform specific location