Skip to content

Instantly share code, notes, and snippets.

View elrok123's full-sized avatar
🙃
:suspect:

Conner Stephen McCabe elrok123

🙃
:suspect:
View GitHub Profile
Nil assertion failed (Exception)
0x10c555f55: *CallStack::new:CallStack at ??
0x10c55608d: *raise<String>:NoReturn at ??
0x10c558130: *Nil#not_nil!:NoReturn at ??
0x10c596948: *MySql::ResultSet#read:(Bool | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | Slice(UInt8) | String | Time | Nil) at ??
0x10c594d69: *DB::ResultSet+@DB::ResultSet#read<Int32:Class>:Int32 at ??
0x10c5aeec8: *Campaign#update_campaign_status<String, String, NamedTuple(campaign_id: Int32, value: String, query: String, count: Int32, id_list: Int32, subject: String, html: String, txt: String, from: String, mirror: String, unsubscribe: String), String>:(DB::ExecResult | Nil) at ??
0x10c59a3d6: *Scheduler#build_campaigns<Array(NamedTuple(scheduler_id: Int32, campaign_id: Int32, account_id: Int32, percentage: Int8, sender_id: Int32))>:Nil at ??
0x10c57ca69: *Scheduler::new<Bool>:Scheduler at ??
0x10c57abff: main at ??
@elrok123
elrok123 / gist:4b2cd3c92f69fbe68225
Created April 24, 2015 22:33
Simple time daemon to periodically save the time to a file every 5 seconds using UNIX libraries and C
//Include required libraries
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <syslog.h>
int main(int argc, char ** argv)
{
@elrok123
elrok123 / gist:f0d15ac0f9ec9b1b9609
Last active August 29, 2015 14:19
Small excerpt from my dev CMS system showing basic PHP data object manipulations to store information in a MySQL database
<?php
/*
* This section of code is used to save user information to the database using PHP Data Objects, it also verifies that the user is signed in
*
*/
//Start session to allow manipulation of session data
session_start();
//Main database access information include
include('../../../../dbaccess/index.php');
//Prewritten modules include (to make life easier)
@elrok123
elrok123 / gist:966611c76f5318d699bb
Created April 24, 2015 21:45
Sell shares method, from an investor portfolio application that I wrote for university
# Sell method for the sell view StockServ, this method is used to sell the clients shares
def sell
# Define client variable with the client ID, used to locate specific client info from database
@client = Client.find(params[:client_id])
# This if statement checks if the user is selling a specific number of shares or whether they just wish to sell all of their shares
#
# Check to see if all required paramaters have been sent, if not check to see if sell all has been set,
# if so perform else, if none of these conditions are met, the else returns the user back to the original page and displays an error
if !params[:sell_quantity].nil? && !params[:owned_share_id].nil? && !params[:shares_quantity].nil? && !params[:sell_quantity].nil?
@elrok123
elrok123 / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class ApplicationController < ActionController::Base
#This is the base application controller in which the current user is held and various other methods
protect_from_forgery
helper_method :current_user, :vat
def vat(income)
vat = (income / 100) * 20
return vat
end
private
def current_user
herp
@elrok123
elrok123 / gist:5564748
Created May 12, 2013 20:13
Order Controller
class OrdersController < ApplicationController
def view
@orders = Order.all
end
def new
@order = Order.new
end
def create
@order = Order.new(params[:order])
@elrok123
elrok123 / Error:
Last active December 17, 2015 06:19
All the files
ActiveRecord::RecordNotFound in OrdersController#create
Couldn't find Product with ID=1 for Order with ID=
Rails.root: /BillingSystem
Application Trace | Framework Trace | Full Trace
app/controllers/orders_controller.rb:10:in `new'
app/controllers/orders_controller.rb:10:in `create'
@elrok123
elrok123 / gist:5564734
Created May 12, 2013 20:09
Error I recvieve when saving multiple products to one order. Products recieved but saving throwing error because order id is null.
ActiveRecord::RecordNotFound in OrdersController#create
Couldn't find Product with ID=1 for Order with ID=
Rails.root: /BillingSystem
Application Trace | Framework Trace | Full Trace
app/controllers/orders_controller.rb:10:in `new'
app/controllers/orders_controller.rb:10:in `create'