Skip to content

Instantly share code, notes, and snippets.

View alpha1125's full-sized avatar

L L alpha1125

  • Toronto, Ontario, Canada
View GitHub Profile
@alpha1125
alpha1125 / LAB#1
Created June 19, 2012 18:32
Wrote a semantic writeup for the image shown.
<!doctype html>
<!-- Conditional comment for mobile ie7 blogs.msdn.com/b/iemobile/ -->
<!--[if IEMobile 7 ]> <html class="no-js iem7" lang="en"> <![endif]-->
<!--[if (gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Some sample add, with html5 mobile boiler template</title>
<meta name="description" content="blah">
Directory tree structure:
.
└── hosts
├── project1
│   └── www
├── project2
│   └── www
listen MySQL localhost:3306
mode tcp
balance roundrobin
server mysql_box1 192.168.1.101:3306 check
server mysql_box2 192.168.1.102:3306 check
@alpha1125
alpha1125 / gist:10133064
Created April 8, 2014 14:28
VBA word, to convert linked images to embedded.
Sub convert_all_inline_shapes()
Dim s As InlineShape
For Each s In ActiveDocument.InlineShapes
If s.Type = wdInlineShapeLinkedPicture Then
' use debug print to get a list of images converted.. not necessary though...
Debug.Print s.Type & " <>"
s.LinkFormat.SavePictureWithDocument = True
s.LinkFormat.Update
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@alpha1125
alpha1125 / excelMergeContents.vba
Last active January 16, 2017 16:02
Excel subroutine to merge the cells AND contents of the select range.
' This excel subroutine that will merge the contents of a selected range,
' concantenate and move all the contents into into the top cell.
'
' keywords: merge, cell, concatenate, join, range, selection
'
' The MIT License (MIT)
' Copyright (c) 2016 Lloyd Leung
'
' Permission is hereby granted, free of charge, to any person obtaining a
' copy of this software and associated documentation files (the "Software"),
@alpha1125
alpha1125 / blink.c
Last active January 16, 2017 18:20
@alpha1125
alpha1125 / gist:723921da68749328c751f1aae78f4d52
Last active August 8, 2017 14:19
doctrine filter vs match.
<?php
$criteria = Criteria::create()->where(Criteria::expr()->eq("id", $listId));
$desiredList = $property->getLists()->matching($criteria);
## $desiredList is an empty ArrayCollection()
## The following works:
@alpha1125
alpha1125 / Doctrine2-oneToMany.php
Created November 1, 2017 15:21
Create one to many relationship, this is a template, to generate the code needed to make oneToMany relationships. Change $A and $B accordingly.
<?php
$A = 'Product';
$B = 'Feature';
echo <<< EOD
<pre>
@alpha1125
alpha1125 / SquareCropApprovalRequiredSubscriber.php
Created December 24, 2017 17:39
Cannot get the User, from TokenStorage
<?php
namespace ContestEngineBundle\Service\EventSubscriber;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class SquareCropApprovalRequiredSubscriber implements EventSubscriber