Skip to content

Instantly share code, notes, and snippets.

View Daniel15's full-sized avatar
💭
Busy

Daniel Lo Nigro Daniel15

💭
Busy
View GitHub Profile
@Daniel15
Daniel15 / gist:2549243
Created April 29, 2012 10:32
LESS mixin for RGBA colours in IE
// Use with colour name: .rgba(black, 0.5) or hex value: .rgba(#FF2400, 0.5)
.rgba(@colour, @alpha)
{
@alphaColour: hsla(hue(@colour), saturation(@colour), lightness(@colour), @alpha);
@ieAlphaColour: argb(@alphaColour);
background-color: @colour; // Fallback for older browsers
background-color: @alphaColour;
// IE hacks
@Daniel15
Daniel15 / gist:2826819
Created May 29, 2012 10:54
Internet Explorer's console.log is not actually a function.
>> document.getElementById
function getElementById() { [native code] }
>> document.getElementById instanceof Function
true
>> document.getElementById.apply
function apply() { [native code] }
>> typeof(document.getElementById)
"function"
>> console.log
function log() { [native code] }
@Daniel15
Daniel15 / gist:bdcfd57b9915bade7d2a
Created November 2, 2015 19:38
Atom instacrash
Process: Atom [19842]
Path: /Applications/Atom.app/Contents/MacOS/Atom
Identifier: com.github.atom
Version: 1.1.0 (1.1.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Atom [19842]
User ID: 215897963
Date/Time: 2015-11-02 11:32:50.249 -0800
@Daniel15
Daniel15 / blah.js
Created November 30, 2015 05:15
Modify source map to move everything down by five lines
var DOCBLOCK_LINES = 5;
var first = new sourceMap.SourceMapConsumer(input);
var generator = new sourceMap.SourceMapGenerator({
file: first.file,
});
first.eachMapping(function(mapping) {
generator.addMapping({
generated: {
column: mapping.generatedColumn,
/// <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 / 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