Skip to content

Instantly share code, notes, and snippets.

Daniel Lo Nigro Daniel15

Block or report user

Report or block Daniel15

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
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: http://i.imgur.com/mPE4M46.png. 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
Daniel15 / gist:5335819
Last active Dec 15, 2015
Nginx configuration for mystatus.im
View gist:5335819
# Redirect away from www subdomain
server {
server_name www.mystatus.im;
return 301 http://mystatus.im$request_uri;
}
server {
server_name mystatus.im;
root /var/www/mystatus.im/site/public/;
@Daniel15
Daniel15 / gist:5335828
Last active Dec 15, 2015
Supervisor config for mystatus.im (/etc/supervisor/conf.d/mystatus.conf)
View gist:5335828
[program:mystatus]
command=node app.js
environment=NODE_ENV=production
user=www-data
directory=/var/www/mystatus.im/
@Daniel15
Daniel15 / alert-1.js
Last active Mar 15, 2017
XSS payloads
View alert-1.js
alert('Daniel15 was here')
@Daniel15
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>("//html5shim.googlecode.com/svn/trunk/html5.js", "_js/html5shim", bundle =>
{
bundle.PageLocation = "head";
// Cast to ScriptBundle is a hack until https://github.com/andrewdavey/cassette/pull/384 is fixed
((ScriptBundle)bundle).Condition = "lt IE 9";
});
View ocp.php
<?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
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
<?php
function last($arr)
{
eval('list(' . str_repeat(',', count($arr) - 1) . '$result) = $arr;');
return $result;
}
@Daniel15
Daniel15 / 1_README.md
Last active Oct 1, 2019
Complete Google Drive File Picker example
View 1_README.md

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 http://stuff.dan.cx/js/filepicker/google/

@Daniel15
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.