Skip to content

Instantly share code, notes, and snippets.

View Daniel15's full-sized avatar
💭
Busy

Daniel Lo Nigro Daniel15

💭
Busy
View GitHub Profile
/// <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 February 8, 2013 13:21
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
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 December 15, 2015 22:49
Nginx configuration for mystatus.im
# 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 December 15, 2015 22:49
Supervisor config for mystatus.im (/etc/supervisor/conf.d/mystatus.conf)
[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 March 15, 2017 15:36
XSS payloads
alert('Daniel15 was here')
@Daniel15
Daniel15 / gist:5632859
Last active December 17, 2015 15:39
Load HTML5 Shim with Cassette
// 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";
});
@Daniel15
Daniel15 / ocp.php
Created June 24, 2013 11:40 — forked from ck-on/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 December 19, 2015 17:28
The worst possible way I could think of to get the last element of an array in PHP. Obviously don't use this.
<?php
function last($arr)
{
eval('list(' . str_repeat(',', count($arr) - 1) . '$result) = $arr;');
return $result;
}
@Daniel15
Daniel15 / 1_README.md
Last active February 12, 2024 19:14
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 http://stuff.dan.cx/js/filepicker/google/

@Daniel15
Daniel15 / CassetteSettings.cs
Created July 23, 2013 22:07
Cassette per-site cache directory
/// <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\";