Skip to content

Instantly share code, notes, and snippets.

Avatar
🐭
Happy Days

Jake Lacey jakelacey2012

🐭
Happy Days
View GitHub Profile
@jakelacey2012
jakelacey2012 / drupal-addnodeform.php
Last active Apr 28, 2016
(Drupal) Node Add Form Programatically
View drupal-addnodeform.php
<?php
/**
* This will fetch and display our node form of a chosen content type.
* @param $type [String] : this is the content type.
* @return $form [array] : form containing elements
*/
function get_node_form($type) {
module_load_include('inc', 'node', 'node.pages');
$form = node_add($type);
@jakelacey2012
jakelacey2012 / decouple.debug.php
Last active May 24, 2016
Decouple DEBUGGING!
View decouple.debug.php
<?php
/**
* updateds nodes helper debug function this is where all our debug code can go
* @param [array] $debug Avaliable debug information pass more for more to become
* @param [boolean] $die This will break on the first interation
* @param [array] $array An array containing all of the values that have been
* passed in one build.
* avaliable.!
*/
View TaskTest.php
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App\Task;
class TaskTest extends TestCase
{
View hook_schema.php
<?php
/**
* Implements hook_schema().
*/
function JwLanalytics_schema() {
$schema = array();
// this has been moveed to the communications manager
$schema['users_logins_data'] = array(
'description' => 'This is where we hold the users login data',
'fields' => array(
View track_user_login.php
<?php
/**
* Helper function to insert the user thats logged in
* to the database
*/
function JwLanalytics_track_user_data_login($uid) {
try {
$timestamp = time();
db_insert('users_logins_data')
->fields( array(
View Global-iris.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Standard Life - Payments Page</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="desktopresources/css/styles.css">
View modalUseful.js
//observe changes so that when elements in the modal,
// change the modal size will also change
modal (...args) {
this.$modal.modal({observeChanges: true}).modal(...args)
}
View MT.js
// const SLIMER_SCRIPT = '/home/jlacey/Documents/workspace/optiq/optiq/packages/zombie/server/slimer-script.js';
const SLIMER_SCRIPT = 'server/slimer-script.js';
function startZombie(done) {
const slimerProcess = childProcess.execFile(
Slimer.path, [Assets.absoluteFilePath( SLIMER_SCRIPT )],
function (err, stdout, stderr) {
console.log('\n--------------------------------');
View Phantomjs-ClientSide
I20161019-08:58:09.251(1)? 2016-10-19T08:58:09 [CRITICAL] QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written
I20161019-08:58:09.429(1)? TypeError: undefined is not an object (evaluating 'Package.modules.meteorInstall')
I20161019-08:58:09.429(1)?
I20161019-08:58:09.429(1)? phantomjs://code/phantomjsScript.js:15 in onError
I20161019-08:58:09.430(1)? http://localhost:3400/packages/promise.js?hash=2d5b025794b9c9e54e5cf6bea71c642ef921a2ed: 17
I20161019-08:58:09.430(1)?
I20161019-08:58:09.430(1)? phantomjs://code/phantomjsScript.js:17
I20161019-08:58:09.431(1)? TypeError: undefined is not an object (evaluating 'Package.modules.meteorInstall')
I20161019-08:58:09.431(1)?
I20161019-08:58:09.431(1)? phantomjs://code/phantomjsScript.js:15 in onError
View ObjectCopying.js
/**
* Object copying with no mutation.
*/
console.log('Test ObjectASssign');
const x = {
name: 'Will',
age: 35,
hair: {
You can’t perform that action at this time.