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 | |
for ( $x=1 ; $x<=100 ; $x++ ) { | |
if ( ( fmod($x,3) == 0 ) && ( fmod($x,7) == 0 ) ) { | |
echo "<span style='color:#ff0000'>Both</span><br/>" ; | |
} else if ( fmod($x,3) == 0 ) { | |
echo "<span style='color:#00ff00'>Three</span><br/>" ; | |
} else if ( fmod($x,7) == 0 ) { | |
echo "<span style='color:#0000ff'>Seven</span><br/>" ; | |
} else { | |
echo $x . "<br/>" ; |
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
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css" /> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Work+Sans:400,100,200,300,500,600,700,800,900" type="text/css" /> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Arvo:400,400italic,700,700italic" type="text/css" /> | |
<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.blue_grey-amber.min.css" /> | |
<style> |
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
/* | |
* Example for adding images to Google Cloud Storage using NodeJS. | |
* This integrates with Firebase, you just need to download the keyfile. | |
* Firebase project > Settings > Firebase Admin SDK > Generate new private key. | |
* Don't forget to install dependancies: "yarn add bluebird @google-cloud/storage" | |
*/ | |
const projectId = 'xxx' | |
const bucketName = projectId+'.appspot.com' | |
const Promise = require('bluebird'); | |
const GoogleCloudStorage = Promise.promisifyAll(require('@google-cloud/storage')); |
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
"use strict" ; | |
function init() { | |
let socket = io('http://localhost:3000'); | |
let div = document.createElement("div"); | |
let top = 10 ; | |
let left = 10 ; | |
let movementIncrement = 5 ; | |
let randomNumber = Math.random() + "" ; |
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
import { AsyncStorage } from 'react-native'; | |
export const actionMethod = () => { | |
return (dispatch, getState) => { | |
(async () => { | |
try { | |
const value = await AsyncStorage.setItem('@YourStore:key', '12345'); | |
if (value !== null) { | |
// Value of the stored token |
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
#! /usr/bin/env node | |
// Resume our input from the console | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
// Receive some data | |
process.stdin.on('data', function (text) { | |
// Split the string arguments | |
const receivedInputArguments = text.replace(/\n$/, '').split(' '); |
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
/* | |
* System for generating x number of unique numbers and writing that to a CSV | |
* document. Good for competitions or anything requiring true unique numbers. | |
* Also an interesting exercise for Node/Javascript perf. | |
*/ | |
const fs = require('fs'); | |
const numbers = []; | |
const start = 111111111; // We don't want any leading 0's | |
const end = 999999999; | |
const amount = 3000000; |
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
import React from 'react'; | |
import * as ReactDOM from 'react-dom'; | |
export default class HQueue extends React.Component<any, any> { | |
constructor(props: any) { | |
super(props); | |
} | |
public componentDidMount() { | |
} |
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
takePicture = async () => { | |
let result = await ImagePicker.launchCameraAsync({ | |
allowsEditing: true, | |
aspect: [4, 3], | |
}); | |
if (!result.cancelled) { | |
// Probably not all necessary, but good to have to do stuff with | |
const context = this; | |
const file = result.uri; |
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
/* | |
* Using Request to generate Facebook messenger codes | |
*/ | |
const request = require('request'); | |
const token = 'FB_TOKEN'; | |
// Request options (pretty standard) | |
const options = { | |
url: 'https://graph.facebook.com/v2.6/me/messenger_codes?access_token='+token, | |
method: 'POST', |