Skip to content

Instantly share code, notes, and snippets.

Avatar

Roger Stringer freekrai

View GitHub Profile
@james2doyle
james2doyle / NextValetDriver.php
Created Nov 17, 2018
A Laravel Valet driver for running generated Next.js sites. This driver assumes you have not changed the default public path (/out) in the next.config.js
View NextValetDriver.php
<?php
/**
* NextValetDriver for running compiled next.js sites
*/
class NextValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
@jlengstorf
jlengstorf / README.md
Created Oct 8, 2014
Adds responsive embedding to WordPress oEmbed content.
View README.md

Responsive Embeds in WordPress

This snippet filters oEmbed output in WordPress (the_content()) to force responsive embeds.

Usage

To use, add the contents of responseive_embeds.less to your site's stylesheet (if you're not using LESS, don't forget to move the iframe,object,embed rule outside of .embed-container and change it to .embed-container iframe,.embed-container object,.embed-container embed).

Then add the responsive_embed() function to your theme's functions.php and insert the add_filter() call in your theme's setup function.

View grab thumb url.php
<?php
/**
* Retrieves the thumbnail URL to use for a post
* @param string $text The body of the post (get_content)
* @param string $size The image size to retrieve
* @return string The image URL to use
*/
function rw_get_thumb_url($text, $size){
global $post;
@btoone
btoone / curl.md
Last active Oct 24, 2021
A curl tutorial using GitHub's API
View curl.md

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@freekrai
freekrai / boyer-moore.php
Created Feb 24, 2012
Boyer-Moore string match algorithm
View boyer-moore.php
<?php
define('ALPHABET_SIZE',1);
function compute_prefix($str,$size,&$result=0)
{
$result = $result[$size + 1];
$q;
$k;
$result[0] = 0;
View gist:945619
<?php
/*
Template Name: Comment Graph
*/
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
@brianleroux
brianleroux / lawnchair-examples.js
Created Jan 27, 2011
examples for using lawnchair js
View lawnchair-examples.js
// create a new store
var store = new Lawnchair({adaptor:'dom', table:'people'});
// saving documents
store.save({name:'brian'});
// optionally pass a key
store.save({key:'config', settings:{color:'blue'}});
// updating a document in place is the same syntax