Skip to content

Instantly share code, notes, and snippets.

View gemmadlou's full-sized avatar

Gemma Black gemmadlou

View GitHub Profile
@gemmadlou
gemmadlou / example.ts
Created October 8, 2015 19:42
Chaining Promises And Recursive Functions
var loopData = [
// Array of Objects
]
EventRepo.GetEventById(req.body.event_id.toString())
.then(function (data: { rows: {}[] }) {
if (data.rows.length === 0)
throw new EventRepoError('Event with id:\'' + req.body.event_id + '\' does not exist');
@gemmadlou
gemmadlou / solution.js
Last active October 20, 2015 20:05
Maximum Call Stack Size Solution
// Must thank Mark McDonnell of Integralist
// http://www.integralist.co.uk/posts/js-recursion.html
// Below is his solution to prevent maximum call stack errors caused by calling
// functions recursively beyond the stack limit.
function tco(f) {
var value;
var active = false;
var accumulated = [];
@gemmadlou
gemmadlou / example-01.ts
Last active February 7, 2023 20:40
Chain of Responsibility Pattern With Typescript - Adding Conditionals Together
/*
Example 01
Business Says
-------------
We only want scores of 4 and above
Developer Says
--------------
Simples. So we use an if statement.
@gemmadlou
gemmadlou / styles.css
Created January 15, 2016 08:25 — forked from pburtchaell/styles.css
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
<?php
function free_and_premium() {
vc_map( array(
"name" => __("Premium", "js_composer"),
"base" => "premium",
"content_element" => true,
"category" => "content>",
"show_settings_on_create" => false,
"params" => array(
// add params same as with any other content element
@gemmadlou
gemmadlou / templates_vc_example.php
Created February 16, 2016 11:12
Visual Composer Shortcodes
<div class=" <?php echo esc_attr( $css_class ); ?> <?php echo $responsive_css; ?>">
<span class="headline <?php echo $settings_css; ?>">
<?php echo do_shortcode($content); ?>
</span>
</div>
<?php echo $this->endBlockComment('headings'); ?>
@gemmadlou
gemmadlou / example.html
Last active March 3, 2016 14:28
Responsive Full Container Width Script
<div data-hmd-full-width data-hmd-min-breakpoint="0" data-hmd-max-breakpoint="767"
style="position: relative; background-color: green;">
Example
</div>
@gemmadlou
gemmadlou / index.md
Last active September 27, 2016 16:24
Random Notes - Functional Programming Style

Random Notes - Functional Programming Style

Sunday 12 June 2016

Note: instead of writing a blog that's well structured and useful, I'm just throwing down notes, pieces of information and code that will help me to build a little application that will (possibly) get real world use. If I achieve it, maybe I might write something a little more helpful. However, you may find this little gist/blog nice to read for your project.

So here's the first bit of code (in at the deep end):

Dependencies include:

@gemmadlou
gemmadlou / file-upload-button.html
Last active June 13, 2016 15:50
File Upload Button with Bootstrap
<label class="btn btn-default btn-file">
Browse <input type="file" style="display: none;">
</label>
@gemmadlou
gemmadlou / react-form-validation-getting-event-data.jsx
Last active June 15, 2016 14:59
React Form Validation & Getting Event Data Snippet
var React = require('react');
var ReactDOM = require('react-dom');
var Validation = require('../helpers/validation');
var has = require('../helpers/has');
var BasicInput = require('../components/basic-input');
var AppealForm = React.createClass({
validateInput: function(validatorFunc, e) {
// Notice position of event data