View fuck_you.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* fUCK yOU php | |
* | |
* @craig552uk | |
*/ | |
<?php | |
You echo to the browser, not to std out. | |
So I hunt for bugs in XHRs or (here or (there about)) |
View cache.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# | |
# A simple memory cache library | |
# Author: Craig Russell <craig@craig-russell.co.uk> | |
# | |
import time | |
class Cache(object): |
View basics_of_unix_philosophy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basics of the Unix Philosophy | |
============================= | |
Rule of Modularity: Write simple parts connected by clean interfaces | |
Rule of Clarity: Clarity is better than cleverness | |
Rule of Composition: Design programs to be connected with other programs | |
Rule of Separation: Separate policy from mechanism; separate interfaces from engines |
View mysql.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Connection, createPool, createConnection, Pool } from 'mysql'; | |
import { MYSQL_DATABASE, MYSQL_HOST, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_USER } from './config.service'; | |
import { InternalServerError } from 'http-errors'; | |
import { LoggerService } from './logger.service'; | |
import { isEmpty } from '../lib/utilities'; | |
const logger = LoggerService.getInstance(); | |
export class MySQLService { |
View Chart.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>My Chart</title> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<p class="my-chart" style="text-align:center"></p> |
View promise_chains.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Promises can only resolve (return) a single value | |
// Sometimes, you want to collect multiple values as you progress through a promise chain | |
// e.g. Customer, Product, Basket, Payment Details | |
// | |
// I can only think of three options for handling this type of scenario (below) | |
// NB: Assume that FOO, BAR & BAZ are the result of some complex action (DB query etc.) | |
// | |
// What are the Pro's & Cons? | |
// Are there others? |
View test_errors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Wrong ways to use Errors in Promises | |
// | |
// Passes Error constructor to next step in Promise chain | |
Promise.resolve('foo').then(val => { | |
return Error('Bad Thing 1'); | |
}).then(val => { | |
console.log('LOG 1', val); |
View python-file-encoding.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- |
View mit-license.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The MIT License (MIT) | |
Copyright (c) <year> <copyright holders> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
View .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Colours | |
txtgrn='\[\e[0;32m\]' # Green | |
txtylw='\[\e[0;33m\]' # Yellow | |
txtblu='\[\e[0;34m\]' # Blue | |
txtpur='\[\e[0;35m\]' # Purple | |
txtcyn='\[\e[0;36m\]' # Cyan | |
txtwht='\[\e[0;37m\]' # White | |
bldblk='\[\e[1;30m\]' # Black - Bold | |
bldred='\[\e[1;31m\]' # Red - Bold | |
bldgrn='\[\e[1;32m\]' # Green - Bold |
NewerOlder