Skip to content

Instantly share code, notes, and snippets.

View ahmeti's full-sized avatar
🎯
Focusing

Ahmet Imamoglu ahmeti

🎯
Focusing
View GitHub Profile
if ( $post->post_parent )
{
wp_redirect( get_permalink( $post->post_parent ), 301 );
}
else
{
wp_redirect( site_url(), 301 ) );
}
die();
@josephspurrier
josephspurrier / AwsController.php
Last active February 24, 2019 15:08
Laravel 5.2 Workflow with Service Providers
<?php
// File Location: projectroot/app/Http/Controllers/AwsController.php
namespace App\Http\Controllers;
use \App;
use \AwsS3;
class AwsController extends Controller
@vladimir-kotikov
vladimir-kotikov / Standartized_splashscreen_support.md
Last active August 3, 2019 21:28
Standartized splash screen support for Cordova
@VassilisPallas
VassilisPallas / index.ts
Last active November 25, 2020 03:12
Equivalent to PHP function number_format in Javascript
const assert = require('assert');
const numberFormat = require('./numberFormat');
assert.strictEqual(
numberFormat(132323232320.321, 2, ',', '.'),
'132.323.232.320,32'
);
assert.strictEqual(
numberFormat(10.22),
'10.22'
@entomb
entomb / php_arrayToXml.php
Created October 8, 2013 01:33
Parses an Array to XML, allows for multiple items with the same key, as long as the parent node is a collection. Useful for those nasty SOAP webservices with auto generated and poor WSDL
<?php
$request = array(
'Test' => array(
'innerTest' => array(
'innerInnerTest' => array(
'someVar' => 'ABCabcXYZxyz',
'arrayVar' => array(
'someString' => 'loremipsum',
'someInt' => 123123123,
@stekhn
stekhn / weightedMean.js
Last active November 20, 2022 03:49
Weighted arithmetic mean (average) in JavaScript
function weightedMean(arrValues, arrWeights) {
var result = arrValues.map(function (value, i) {
var weight = arrWeights[i];
var sum = value * weight;
return [sum, weight];
}).reduce(function (p, c) {
@ecowden
ecowden / angular-partial-cache-busting
Created January 25, 2013 21:01
Cache busting for AngularJS partials is easy
/*
* Decide on your cache-busting strategy. In this example, we use the current timestamp, which will
* force a change every time the app is visited, but not every time the partial is loaded within a
* visit. Even better would be to use a hash of the file's contents to ensure that the file is always
* reloaded when the file changes and never reloaded when it isn't.
*/
var cacheBustSuffix = Date.now();
// Optionally, expose the cache busting value as a constant so other parts of your app can use it.
ngModule.constant("cacheBustSuffix", cacheBustSuffix);
@ScripTech
ScripTech / Activate Office 2019 for macOS VoL.md
Created August 10, 2020 18:21 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

<?php
///////////////////////////////////////////////////
// STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY
///////////////////////////////////////////////////
namespace App\MyApp;
class MyApp {
public function sayHello($data = [])
{
echo "Hello World from Facade!";
}
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active December 21, 2023 22:55
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa