Skip to content

Instantly share code, notes, and snippets.

@jonlambert
jonlambert / README.md
Created August 22, 2019 10:29
Fix helm installation error

Fix for the following error:

$ helm install stable/nginx-ingress
Error: no available release name found

Run this command:

@jonlambert
jonlambert / Main.cpp
Last active September 26, 2015 15:50 — forked from anonymous/Main.cpp
#include<stdlib.h>
#include<stdio.h>
int main()
{
int type = 0, size = 0, castValue = size, origin = 0, euuk = 0, usuk = 0, europe = 28, usa = 4;
bool validChoice = false;
printf("This program is designed to convert all different sizes to UK equivalent. \n");
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@jonlambert
jonlambert / prefix.php
Last active August 29, 2015 14:07
Changing the database table prefix in Wordpress does NOT increase security.
<?php
/**
* This code may not work, it's pretty much pseudocode, as I'm presuming get_results() will return an array of tables. I don't have a Wordpress installation to test it!
* The idea is correct though, and the command `SHOW TABLES` will 100% return a list of tables in the database.
*
* But for arguments sake, lets assume the format returned is as below.
*/
function getWordpressTablePrefix() {
require 'net/http'
def fetch
puts "Super Simple (Shakespearian) Question Fetcher (v1.0)"
puts "(c) Mr J. Outer-Whipsy 2014 (All rights reserved)"
puts "Refreshing questions..."
url = URI.parse('http://h4inschools.schoolsbroadcast.org.uk/v1/orad/source.xml')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
SELECT node.title,
field_data_gsl_addressfield.gsl_addressfield_country,
field_data_gsl_addressfield.gsl_addressfield_postal_code,
field_data_gsl_props_phone.gsl_props_phone_value,
field_data_gsl_geofield.gsl_geofield_lat,
field_data_gsl_geofield.gsl_geofield_lon
FROM node
WHERE field_data_gsl_addressfield.gsl_addressfield_country = "GB"
INNER JOIN field_data_gsl_addressfield ON field_data_gsl_addressfield.entity_id = node.nid
INNER JOIN field_data_gsl_props_phone ON field_data_gsl_props_phone.entity_id = node.nid

2D Arrays

Tables can be represented as 2D arrays.

$table = array(
  "Row 1" => array("Column 1 - row 1", "Column 2 - row 1", "Column 3 - row 1"),
  "Row 2" => array("Column 1 - row 2", "Column 2 - row 2", "Column 3 - row 2")
);
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
BookingPageViewController *bookingPageViewController = [[BookingPageViewController alloc] init];
bookingPageViewController.booking = [self.bookings objectAtIndex:indexPath.row];
[self.navigationController pushViewController:bookingPageViewController animated:YES];
}
@jonlambert
jonlambert / gist:4578008
Created January 20, 2013 11:28
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
#import <UIKit/UIKit.h>
#import "NewBookingViewController.h"
@interface BookingMainViewController : UITableViewController
<NewBookingDelegate>
@property (nonatomic, assign) NSMutableArray *bookings;
- (IBAction)addNewBooking;
@end