Skip to content

Instantly share code, notes, and snippets.

View SourceCode's full-sized avatar
👽
Byte Inspector

Ryan R SourceCode

👽
Byte Inspector
  • Weyland-Yutani Corporation
  • USA
View GitHub Profile
@SourceCode
SourceCode / workbooknames
Created February 1, 2015 08:09
Sets current workbook to names of existing workbook tabs
Sub ListWorkSheetNames()
'Updateby20140624
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
For i = 1 To Application.Sheets.Count
xWs.Range("A" & i) = Application.Sheets(i).Name
Next i
End Sub
@SourceCode
SourceCode / fizzbuzz.php
Created December 20, 2015 05:32
FizzBuzz Challenge
<?php
echo '<pre>';
for($i = 1; $i < 100; $i++)
{
if ($i % 3 == 0 && $i % 5 == 0)
{
echo 'FizzBuzz';
} else if ($i % 3 == 0)
{
echo 'Fizz';
@SourceCode
SourceCode / clockangle.php
Created December 20, 2015 05:46
Clock Hand Angle Challenge
<?php
$hourAngleRate = 360 / 12;
$minuteAngleRate = 360 / 60;
function timeAngle($hour, $min)
{
global $hourAngleRate, $minuteAngleRate;
if ($hour > 12 || $min > 60) return false;
@SourceCode
SourceCode / fibonacci.php
Created December 20, 2015 13:36
Fibonacci Challenge
<?php
function fib($n)
{
return $n < 3 ? 1 : fib($n - 1) + fib($n - 2);
}
?>
@SourceCode
SourceCode / primenumber.php
Created December 21, 2015 06:09
Prime Number Challenge
<?php
function primeNumber($n)
{
if ($n % 2 == 0) return false;
for ($i = 3; $i <= sqrt($n); $i += 2)
{
if ($n % $i === 0) return false;
}
return true;
}
@SourceCode
SourceCode / monolog.json
Created March 4, 2016 20:22 — forked from skowron-line/monolog.json
lnav Monolog format
{
"monolog": {
"title": "Monolog log file",
"description": "Monolog log format",
"url": "https://github.com/Seldaek/monolog",
"regex": {
"default": {
"pattern": "\\[(?P<timestamp>.*)\\] (?P<logger>\\w+).(?P<level>\\w+): (?P<message>[^\\[\\{]+) (?P<context>[\\[\\{].*[\\]\\}]) (?P<extra>[\\[\\{].*[\\]\\}])"
}
},
@SourceCode
SourceCode / reference.yml
Created May 17, 2016 16:35 — forked from mnapoli/reference.yml
Doctrine YAML configuration reference
# Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html
MyEntity:
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
namedQueries:
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
@SourceCode
SourceCode / git-since-date
Created August 3, 2016 00:33
git command to get commits since date
git log --after=2016-06-31 --pretty=format:"Committed %h on %cd %s"
@SourceCode
SourceCode / phpstorm xdebug php.ini
Last active September 4, 2016 00:50
phpstorm xdebug config - update the <path>, <tmp dir> and your xdebug dll
; XDEBUG Extension
[xdebug]
zend_extension ="<path>/php_xdebug-*.dll"
xdebug.remote_enable = 1
xdebug.remote_port=9000
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="<tmp dir>"
xdebug.show_local_vars=1
@SourceCode
SourceCode / Deployment Bootstrap Script
Created September 4, 2016 20:38
Basic Bootstrap Shell Script to Start a Deployment
cd ~
wget http://mydomain/deployment/deployment.script
awk '{ sub("\r$", ""); print }' deployment.script > deploy.sh
chmod +x deploy.sh
./deploy.sh
echo 'Deployment Complete'