Skip to content

Instantly share code, notes, and snippets.

View craiglondon's full-sized avatar

Craig London craiglondon

View GitHub Profile
@darisi
darisi / Gruntfile.js
Last active September 14, 2019 20:14
Uncss setting with grunt examples
uncss: {
dist: {
options: {
ignore: [
/(#|\.)fancybox(\-[a-zA-Z]+)?/,
/expanded/,
/js/,
/wp-/,
/align/,
/admin-bar/,
@Driver86
Driver86 / config.php
Created August 20, 2016 14:20
Yii2 Config for CDN-assets with current versions from Composer
<?php
$bundles = [];
foreach(json_decode(file_get_contents(__DIR__ . '/composer.lock'))->packages as $package) {
if (!preg_match('#^bower-asset/(.+)$#', $package->name, $name) or !preg_match('#^v?(.+)$#', $package->version, $version)) {
continue;
}
$name = $name[1];
$version = $version[1];
switch ($name) {
@stephenhowells
stephenhowells / gist:4021772
Created November 6, 2012 01:10
Apache conf snippet to hide .git directories and .gitignore files.
# do not allow .git version control files to be issued
<Directorymatch "^/.*/\.git+/">
Order deny,allow
Deny from all
</Directorymatch>
<Files ~ "^\.git">
Order allow,deny
Deny from all
</Files>
@64bitint
64bitint / ActiveQueryRelationViaSubquery.php
Last active January 12, 2021 15:05
Yii2 via relations using subqueries
<?php
namespace app\components\db;
use yii\db\ActiveQuery;
use yii\db\Query;
/**
* Class ActiveQueryRelationViaSubquery
*
* This class extends the Yii ActiveQuery class to allow the use
* of sub queries for hasMany relations using the via() method by calling
@johnkary
johnkary / WSSoapClient.php
Created June 27, 2012 20:08
WS-Security for PHP SoapClient
<?php
/**
* Copyright (c) 2007, Roger Veciana
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
@amolofos
amolofos / modern.ie.vms.json
Last active November 30, 2021 19:15
modern.ie json dataset
<script>
var edgePortal = window.edgePortal || {};
edgePortal.vms = {
"id":"20150817",
"releaseNotes":"http://az792536.vo.msecnd.net/vms/release_notes_license_terms_8_1_15.pdf",
"osList":[{
"osName":"Windows",
"softwareList":[{
"softwareName":"HyperV_2008R2",
"browsers":[{
@joecampo
joecampo / Connecting PHP 5.6 to MSSQL.md
Last active June 4, 2022 14:20
Connecting PHP 5.6 to MSSQL - Ubuntu (Debian) w/ Apache
@mems
mems / gist:d54ad804d8d8d17d0011
Last active October 24, 2022 03:24
Found the Apple live stream URL
  1. Open http://www.apple.com/live/ which redirect to something like http://www.apple.com/live/2015-june-event/
  2. Find a loaded script like: /live/2015-june-event/scripts/2015-june-event.built.js
  3. Open this script and search p.events-delivery.apple.com.edgesuite.net You find something like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/js_files/event
  4. append to it /url.json (details: host + path + url.json)
  5. Open the generated URL
  6. Found an URL like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/m3u8/hls_mvp.m3u8

Now you can watch it in VLC or any other videoplayer that support M3U and MP4(H264+AAC)!

@jgaydos
jgaydos / ubuntu18.04_php7.3_sqlsrv.sh
Last active November 21, 2022 21:02
Ubuntu 18.04 + PHP7.3 + SQLSRV
#!/bin/bash
#ubuntu 18.04
#php7.3
# install php ppa
apt -y install software-properties-common
add-apt-repository ppa:ondrej/php -y
apt update
@tristar500
tristar500 / String to Float.php
Created December 7, 2013 22:52
Convert string value with commas into a float
$val = "1,234,988.56";
$num = floatval(str_replace(",","",$val));
echo $num;
// returns - 1234988.56