Skip to content

Instantly share code, notes, and snippets.

Younes El Biache younes0

Block or report user

Report or block younes0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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;
@younes0
younes0 / Discogs.php
Created Aug 3, 2014
Discogs League Oauth1 Client Provider
View Discogs.php
<?php
namespace League\OAuth1\Client\Server;
use League\OAuth1\Client\Credentials\TokenCredentials;
class Discogs extends Server
{
/**
* {@inheritDoc}
You can’t perform that action at this time.