This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.side-menu-buttons a{ text-align:center; color:#555; } | |
.align-center{ | |
text-align:center; | |
} | |
img{ | |
width:100%; | |
height:auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$connect = mysqli_connect("localhost", "root", "", "r8m3"); | |
$query = mysqli_query($connect, "SELECT * FROM images"); | |
$images = array(); | |
while($result = mysqli_fetch_assoc($query)){ | |
$images[] = $result["id"]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
each([1, 2, 3], function (val) { | |
console.log(val); | |
}); | |
// 1 | |
// 2 | |
// 3 | |
var each = function (array, callback) { | |
// Including array.length as variable declaration to "cache" it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$image = $inputs['image']; | |
/* | |
When I refer to the "front-end image", I mean the uploaded version of the image you see | |
in jCrop/cropping screen in the webpage of the site, NOT the actual file. | |
Omitted variable declarations: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window) { | |
'use strict'; | |
var angular = window.angular; | |
angular.module('myhonorsCitizenship').factory('CitizenshipService', ['FirebaseIO', 'UserService', 'FirebaseCollection', '$q', 'EventService', function (FirebaseIO, UserService, FirebaseCollection, $q, EventService) { | |
var citizenshipFactory = { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var pElements = document.getElementsByTagName("p"); //NodeList | |
var pElement = document.getElementById("foo"); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In PHP, variables are function-scoped. Use call_user_func to prevent global pollution. | |
call_user_func( | |
function() { | |
for ($i=1; $i<101; $i++) { | |
// Reset variables every loop as PHP variables are function scoped, not block scoped. | |
$divisibleBy3 = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Written by: Alastair Paragas | |
Run the program by copy/pasting this code to http://repl.it/languages/JavaScript. | |
This program finds how many bitstrings of length 10 does not contain a set of two consecutive 1s | |
*/ | |
(function (window) { | |
'use strict'; | |
var binaryRepresentation, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function scoped - prevent global namespace pollution | |
(function (window) { | |
'use strict'; | |
// Bootstraps our Fibonacci program | |
function runProgram() { | |
/* | |
Recursive function with two base cases: | |
First 2 terms of Fibonacci sequence are 0 and 1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window) { | |
'use strict'; | |
var FirebaseRef = new window.Firebase("firebase-url-here"), | |
document = window.document; | |
FirebaseRef.on("value", function (eventsSnapshot) { | |
var events = eventsSnapshot.val(), | |
eventsListed = {}, | |
eventsDateSorted = [], |
OlderNewer