Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Lo Nigro Daniel15

View GitHub Profile
View Jint StackOverflowException
Jint.dll!Jint.Native.Object.ObjectInstance.DefineOwnProperty(string propertyName, Jint.Runtime.Descriptors.PropertyDescriptor desc, bool throwOnError) Line 362 C#
Jint.dll!Jint.Native.Argument.ArgumentsInstance.DefineOwnProperty(string propertyName, Jint.Runtime.Descriptors.PropertyDescriptor desc, bool throwOnError) Line 147 C#
Jint.dll!Jint.Native.Argument.ArgumentsInstance.CreateArgumentsObject(Jint.Engine engine, Jint.Native.Function.FunctionInstance func, string[] names, Jint.Native.JsValue[] args, Jint.Runtime.Environments.EnvironmentRecord env, bool strict) Line 70 C#
Jint.dll!Jint.Engine.DeclarationBindingInstantiation(Jint.DeclarationBindingType declarationBindingType, System.Collections.Generic.IList<Jint.Parser.Ast.FunctionDeclaration> functionDeclarations, System.Collections.Generic.IList<Jint.Parser.Ast.VariableDeclaration> variableDeclarations, Jint.Native.Function.FunctionInstance functionInstance, Jint.Native.JsValue[] arguments) Line 672 C#
Jint.dll!Jint.Native.Function.ScriptFunctionInstance
View Esprima stack trace
at scanComment (http://localhost/temp/JSXTransformer.js:6369:19)
at advance (http://localhost/temp/JSXTransformer.js:2988:13)
at lex (http://localhost/temp/JSXTransformer.js:3059:21)
at parseNonComputedProperty (http://localhost/temp/JSXTransformer.js:4267:21)
at http://localhost/temp/JSXTransformer.js:7394:38
at parseNonComputedMember (http://localhost/temp/JSXTransformer.js:4279:16)
at trackLeftHandSideExpressionAllowCall (http://localhost/temp/JSXTransformer.js:7307:67)
at parsePostfixExpression (http://localhost/temp/JSXTransformer.js:4347:20)
at http://localhost/temp/JSXTransformer.js:7394:38
at parseUnaryExpression (http://localhost/temp/JSXTransformer.js:4411:16)
@Daniel15
Daniel15 / Tutorial.jsx
Created Apr 7, 2014
ReactJS.NET Tutorial v1
View Tutorial.jsx
/** @jsx React.DOM */
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
var xhr = new XMLHttpRequest();
xhr.open('get', this.props.url, true);
xhr.onload = function() {
var data = JSON.parse(xhr.responseText);
this.setState({ data: data });
}.bind(this);
xhr.send();
@Daniel15
Daniel15 / fix.php
Created May 11, 2014
Fixing badly-encoded UTF-8 characters in MySQL database
View fix.php
<?php
// Go home PHP, you're drunk.
// No charset here
$old_db = new PDO('mysql:host=localhost;dbname=database', 'username', 'password');
$old_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Charset here
$new_db = new PDO('mysql:charset=utf8mb4;host=localhost;dbname=database2', 'username', 'password');
$new_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@Daniel15
Daniel15 / gradient.js
Created May 12, 2014
CSS gradient animation using Prototype
View gradient.js
(function() {
var setLinearGradient;
// Figure out what prefix the current browser uses for gradients
var tempEl = new Element('div');
tempEl.style.cssText =
'background-image: -moz-linear-gradient(top, red 0%, white 100%); \
background-image: -webkit-linear-gradient(top, red 0%, white 100%); \
@Daniel15
Daniel15 / gist:3cfaa4489910896a96b0
Created May 22, 2014
Supervisor config for dan.cx
View gist:3cfaa4489910896a96b0
[fcgi-program:mono]
command=/usr/local/bin/fastcgi-mono-server4 /applications=dan.cx:/:/var/www/dan.cx/site/
user=www-data
socket=unix:///var/run/mono/mono.socket
socket_owner=www-data
View gist:5b2b660ad097d54b0e78
<?php
if ($utf8) {
if (function_exists('mb_strtolower')) {
$strtolower = function ($string) { return mb_strtolower($string); }
} else {
require_once($sourcedir . '/Subs-Charset.php');
$strtolower = function ($string) { return utf8_strtolower($string); }
}
} else {
View keybase.md

Keybase proof

I hereby claim:

  • I am Daniel15 on github.
  • I am daniel15 (https://keybase.io/daniel15) on keybase.
  • I have a public key whose fingerprint is 78DC 765F 9EF3 08CC 0249 B136 C159 189E 8674 E211

To claim this, I am signing this object:

View gist:5c5b4407305b505acde7
var Options = React.createClass({
savePrice: function(price) {
localStorage.setItem("Price", price);
},
_renderOptions: function() {
return this.props.data.map(function(option) {
return (
<Option
price={option.price}
@Daniel15
Daniel15 / gist:081cc25b0ce166646528
Created May 31, 2014
composer.json example for XHP in Laravel
View gist:081cc25b0ce166646528
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*",
"facebook/xhp": "dev-master"
},
"autoload": {