Skip to content

Instantly share code, notes, and snippets.


Daniel Lo Nigro Daniel15

View GitHub Profile
View gist:4452596
/// <summary>
/// Copy shared properties from <paramref name="source"/> to <paramref name="dest"/>.
/// Shared properties are those that both types have.
/// This is similar to AutoMapper which only works on .NET 4
/// </summary>
/// <typeparam name="TSource">Source type</typeparam>
/// <typeparam name="TDest">Destination type</typeparam>
/// <param name="source">Source object</param>
/// <param name="dest">Destination object</param>
/// <returns>Destination object with all the shared properties copied over</returns>
Daniel15 / gist:4739018
Created Feb 8, 2013
This is some (very ugly) code I wrote when I was 11 years old (2001). It was part of this game: Clearly I was destined to be an artist for video games, but something didn't quite work out :P
View gist:4739018
Option Base 1
Dim cardtxt(23, 3) As String
Dim CurPlayer As Integer
Dim AmtMoney(4) As Long
Dim moved(4) As Integer
Dim Level(4) As Integer
Dim landowner(7) As Integer
Dim colour(4)
Dim click1, click2, speed, ended, temp_pic, ok_en, spinner_enabled, won, next_turn
Const txt = 1
Daniel15 / gist:5335819
Last active Dec 15, 2015
Nginx configuration for
View gist:5335819
# Redirect away from www subdomain
server {
return 301$request_uri;
server {
root /var/www/;
Daniel15 / gist:5335828
Last active Dec 15, 2015
Supervisor config for (/etc/supervisor/conf.d/mystatus.conf)
View gist:5335828
command=node app.js
Daniel15 / alert-1.js
Last active Mar 15, 2017
XSS payloads
View alert-1.js
alert('Daniel15 was here')
Daniel15 / gist:5632859
Last active Dec 17, 2015
Load HTML5 Shim with Cassette
View gist:5632859
// HTML5 shim needs to be separate as only IE needs it
bundles.AddUrlWithAlias<ScriptBundle>("//", "_js/html5shim", bundle =>
bundle.PageLocation = "head";
// Cast to ScriptBundle is a hack until is fixed
((ScriptBundle)bundle).Condition = "lt IE 9";
View ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
Daniel15 / gist:5991193
Last active Dec 19, 2015
The worst possible way I could think of to get the last element of an array in PHP. Obviously don't use this.
View gist:5991193
function last($arr)
eval('list(' . str_repeat(',', count($arr) - 1) . '$result) = $arr;');
return $result;
Daniel15 /
Last active Jul 6, 2020
Complete Google Drive File Picker example

Google Drive File Picker Example

This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.

Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.

See a demo at

Daniel15 / CassetteSettings.cs
Created Jul 23, 2013
Cassette per-site cache directory
View CassetteSettings.cs
/// <summary>
/// Handles custom configuration of Cassette
/// </summary>
public class CassetteSettings : IConfiguration<Cassette.CassetteSettings>
/// <summary>
/// Base cache path
/// </summary>
private const string CACHE_BASE_PATH = @"c:\temp\Cassette\";
You can’t perform that action at this time.