Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ryanwinchester's full-sized avatar
⚗️
Working on open-source and side projects

Ryan Winchester ryanwinchester

⚗️
Working on open-source and side projects
View GitHub Profile
@ryanwinchester
ryanwinchester / .htaccess
Last active August 29, 2015 14:02
Allow Cross-domain origin requests for webfonts in .htaccess
# Apache config to allow access to webfonts from all domains:
<IfModule mod_headers.c>
<FilesMatch "\.(eot|otf|tt[cf]|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
@ryanwinchester
ryanwinchester / homestead.sh
Created June 20, 2014 17:38
Start up Homestead VM
#!/bin/bash
cd c:/vagrant/Homestead
vagrant up
while true; do
read -p "Do you want to quit yet?" yn
case $yn in
[Yy]* ) vagrant halt; break;;
* ) echo "Okay then. Waiting for (y)es...";;
@ryanwinchester
ryanwinchester / codility-1_1.php
Last active August 29, 2015 14:10
Codility TapeEquality O(n)
<?php
/**
* @param array $A
* @return int
*/
function solution(array $A)
{
$left = $A[0];
$right = array_sum($A) - $left;
@ryanwinchester
ryanwinchester / ben_lowerys_form
Created February 5, 2015 18:13
Blade form includes
@include('Core::partials.viewmodelmessages')
<div class="form-horizontal">
<fieldset>
<legend>Contractor Company Details</legend>
@include('Core::components.textinput',['label' => 'Company Name', 'name' => 'company_name'])
@include('Core::components.textinput',['label' => 'Registration No.', 'name' => 'reg_no'])
@include('Core::components.textinput',['label' => 'Vat Reg.', 'name' => 'vat_reg'])
</fieldset>

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ryanwinchester
ryanwinchester / bitwise.php
Last active August 15, 2023 05:16
BITWISE FLAGS for Custom PHP Objects
<?php
/**
* BITWISE FLAGS for Custom PHP Objects
*
* @link http://php.net/manual/en/language.operators.bitwise.php#108679
*
* Sometimes I need a custom PHP Object that holds several boolean TRUE or FALSE values.
* I could easily include a variable for each of them, but as always, code has a way to
* get unweildy pretty fast. A more intelligent approach always seems to be the answer,
@ryanwinchester
ryanwinchester / countries.php
Last active August 29, 2015 14:27 — forked from JeffreyWay/countries.php
Country Names + Codes
[
"Canada" => "ca",
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
@ryanwinchester
ryanwinchester / .bash_profile
Last active August 29, 2015 14:27 — forked from JeffreyWay/.bash_profile
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@ryanwinchester
ryanwinchester / .aliases
Last active September 25, 2015 16:01
Shell Aliases
#
## Source a .aliases file:
# if [ -f ~/.zsh/zshalias ]; then
# source ~/.aliases
# else
# print "404: ~/.aliases not found."
# fi
#
# Beautiful git log
@ryanwinchester
ryanwinchester / ip_in_range.php
Last active March 15, 2021 18:25 — forked from tott/ip_in_range.php
php check if IP is in given network range
<?php
/**
* Check if a given ip is in a network.
*
* @see https://gist.github.com/ryanwinchester/578c5b50647df3541794
*
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed