Skip to content

Instantly share code, notes, and snippets.

View junerockwell's full-sized avatar
💭
I may be slow to respond.

June Rockwell junerockwell

💭
I may be slow to respond.
View GitHub Profile
@junerockwell
junerockwell / JS_Concatenation.md
Last active August 5, 2024 18:27
Make strings using JavaScript concatenation

String Concatenation in JavaScript

The examples are combining string and number data types with and/or without variables. This is called concatenation.

The original, "old school," way is using + (plus). The latest way for the last few years is using backticks with ${variableName}.

var assert = require('assert');
/********************************
* We want make a package of goal kilos of skittles. We have
* inventory of small bags (1 kilos each) and big bags (5 kilos each).
* Return the number of small bags to use, assuming we always
* use big bags before small bags. Return -1 if it can't be done.
*
* See the asserts below for examples of input
* and expected output.
@junerockwell
junerockwell / controllers.js
Last active August 29, 2015 14:18
collection-item prevents lazy images to load automatically when their already in view
.controller('RecipiesController', function($scope, RecipesFactory, $timeout, $cordovaNetwork, $ionicPlatform, $rootScope, $interval) {
$scope.recipes = [];
$scope.limit = 10;
$scope.hideIonSpinner = true;
$scope.statusMessage = "";
$scope.showStatusMessage = false;
$ionicPlatform.ready(function() {
if ($cordovaNetwork.isOnline()) {
@junerockwell
junerockwell / app.js
Last active September 18, 2022 05:36
ngMap for Ionic
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', [
'ionic',
'starter.controllers'])
@junerockwell
junerockwell / getcoordinates
Last active August 29, 2015 14:07
Gist of code to show to Titanium JIRA
Ti.Geolocation.purpose = 'Find Nearby Trails';
if (Ti.Geolocation.locationServicesEnabled) {
if (OS_IOS) {
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
Ti.Geolocation.activityType = Ti.Geolocation.ACTIVITYTYPE_FITNESS;
} else if (OS_ANDROID) {
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HIGH;
}
Ti.Geolocation.getCurrentPosition(function(e) {