Skip to content

Instantly share code, notes, and snippets.

View SecretDeveloper's full-sized avatar
🎯
Focusing

Gary Kenneally SecretDeveloper

🎯
Focusing
View GitHub Profile
@SecretDeveloper
SecretDeveloper / Widget code isolation.js
Last active August 29, 2015 14:04
Widget code isolation
var myVariable = "Some external value;"
(function(root){
var myVariable = "Some internal value;"
console.log(myVariable); // will be "Some internal value"
})(window);
console.log(myVariable); // will still be "Some external value"
@SecretDeveloper
SecretDeveloper / Widget configuration injection.js
Last active August 29, 2015 14:04
Widget configuration injection
(function(root){
var widget = function(){
var self = this;
// configuration
var config = {
css:{
theme:'current'
@SecretDeveloper
SecretDeveloper / PHP badness
Last active September 27, 2015 04:07
PHP badness
<?php
$result = mysql_query('SELECT * FROM Customers');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
@SecretDeveloper
SecretDeveloper / SubSetSumSolution.cs
Last active September 25, 2015 07:28
.Net solution to the subset sum problem.
public class SubSetSolver
{
// Define other methods and classes here
public void Solve(string input)
{
List<int> seq = input.Split(',').Select(x => int.Parse(x)).ToList();
seq.Sort();
List<List<int>> combinations = new List<List<int>>(seq.Count *2);