Skip to content

Instantly share code, notes, and snippets.

View mom-mock Index
<!DOCTYPE html>
<html>
<head>
{% block head %}
<title>Magenerds - Magento Order Management Mock</title>
{% endblock %}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
View gist:699bfdab780cef4483aca05da2cf555b
SELECT * FROM training ORDER BY CASE
WHEN name NOT LIKE '&#%' THEN
1
ELSE 2
END,
name LIMIT 200 OFFSET 0
@younes0
younes0 / ueCookie.js
Last active May 11, 2016
UE Cookie banner - Accept if click on body and not banner - REQUIRED: https://github.com/js-cookie/js-cookie
View ueCookie.js
var setupUeCookie = function(acceptCallback) {
var key = 'UE_COOKIE';
var ueCookie = Cookies.get(key);
var $banner = $('#ueCookie');
var onUeCookieAccept = function() {
Cookies.set(key, true);
$banner.hide();
acceptCallback();
};
View reglex-usage.php
<?php
use Younes0\Reglex\Basic;
use Stringy\Stringy;
$output = [];
// basic
$class = new \ReflectionClass(Basic::class);
$methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
View reglex-usage.js
var $body = $("#text");
$.each(reglexResults, function(i, array) {
var content = '';
$.each(array, function(key, value) {
content+= key + ': '+ value +'<br>';
});
View former.blade.php
@extends('layouts.master')
@section('top')
@partial('blocks._header')
@block('title', 'Profile')
@endpartial
@parent
@stop
@younes0
younes0 / rankitwp_wpapi1.md
Last active Nov 10, 2015
RankIt WP + WP-REST Api 1.x
View rankitwp_wpapi1.md

RankIt WP + WP-REST Api 1.x

Install plugins:

  • WP-REST Api 1.2.x and NOT 2.x (Basic-Auth and OAuth do not work with 2.x)
  • wp-api-basic-auth
// 2- wordpress functions.php
function rest_wpri_insert_post($post, $data, $update) {
    // add custom taxonomy
View ExtendedModel.php
<?php
use Illuminate\Database\Eloquent\Model;
class ExtendedModel extends Model
{
protected $nullable = [];
public static function boot()
{
@younes0
younes0 / DiscogsApi.md
Last active Sep 20, 2015
Setting up Discogs PHP API client with OAuth feature
View DiscogsApi.md

Setting up Discogs PHP API client with OAuth feature

Get these composer packages

"guzzlehttp/guzzle": "4.1.x",
"guzzlehttp/oauth-subscriber": "0.1.x",
"league/oauth1-client": "~1.0",
@younes0
younes0 / RateLimitSubscriber.php
Last active Dec 4, 2015
Rate Limit Subscriber for Guzzle 4.x + Laravel
View RateLimitSubscriber.php
<?php
/**
* Todo: Decouple from Laravel's Caching system
**/
use GuzzleHttp\Collection;
use GuzzleHttp\Event\BeforeEvent;
use GuzzleHttp\Event\CompleteEvent;
use GuzzleHttp\Event\EmitterInterface;