Skip to content

Instantly share code, notes, and snippets.

Timothy timothy

Block or report user

Report or block timothy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timothy
timothy / Count in a Circle Loop
Created Jul 12, 2017
circular count within a loop
View Count in a Circle Loop
//circular count within a loop example
std::string key = "12345";
for (int i = 0, j = 0; i < 30; ++i)
{
std::cout << j;
j = (int) ((j + 1) % key.length());
}
View gist:e5079bcd4021cf78305acc622d67c71e
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
sudo apt autoremove # Removes unused packages
google-chrome --disable-web-security
chromium-browser --disable-web-security --user-data-dir
//for caching git credentials...
git config --global credential.helper 'cache --timeout 3600'
@timothy
timothy / HTML View of Console.log output
Created Apr 19, 2017
show console output on web page
View HTML View of Console.log output
<pre id="log"></pre>
<script>
(function() {
var old = console.log;
var logger = document.getElementById('log');
console.log = function() {
for (var i = 0; i < arguments.length; i++) {
if (i > 0) {
logger.innerHTML += " ";
}
@timothy
timothy / Google chrome dev session instance
Last active Mar 1, 2017
Creates new temp/dev Chrome session with security disabled
View Google chrome dev session instance
##This example is for Windows OS.
1. Create chrome shortcut.
2. Go to shortcut properties and add the below to the end of the shortcut target.
3. add as many other flags to the end as you need. i.e. --disable-web-security
--args --user-data-dir="/tmp/chrome_dev_session" --disable-web-security --ignore-certificate-errors --allow-running-insecure-content
or enter... to cmd...
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --args --user-data-dir="/tmp/chrome_dev_session" --disable-web-security --ignore-certificate-errors --allow-running-insecure-content
"Put the file location of chrome.exe for your system in the quotes..." --args --user-data-dir="/tmp/chrome_dev_session" --disable-web-security --ignore-certificate-errors --allow-running-insecure-content
View JavaScript Graphics Clamping
function Clamp(x, min, max) {
return x < min ? min: (x > max ? max: x);
}
View JavaScript Recursive Factorial
/**
* Author https://github.com/timothy
* @return {number}
*/
function Factorial(num) {
return num <=1 ? 1 : num * Factorial(num - 1);
}
console.log(Factorial(8));
View DOM Manipulation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DOM Manipulation</title>
</head>
<body>
<script type="text/javascript">
/**
* Add new DOM elements
View javascript unique random number generator
/**
* this takes in a number and returns
* an array of unique random numbers
* starting from o to the amount given.
* @param {number} amount this is the range and the amount of random numbers
* @returns {Array} unique random numbers between 0 and amount
*/
function uniquRand(amount) {
var uRandA = [];
var random = 0;
View Building App from scratch
Step by step to create a new app from scratch
1. Build simple Requirements doc
2. Extract Use Cases from Requirements Doc
3. Find Use Case Dependencies. i.e. use case 5 cannot be done until 2 is complete…
4. Order Use Cases. Start with the most essential use case that has no dependencies.
5. Find all Core use cases. i.e. Adds to the structure of the app and adds data to app. Then find supporting use cases to implement to test…
Sketch out User experience. i.e. what will the site look like…
View npm commands -- gulp specific
-g //this means global
--save-dev // save to the davDependencies in package.json
--save // save to the Dependencies in package.json
//find all global packages
npm list -g --depth=0
//Install packages for a specific project locally. Install as dev dependency.
npm install --save-dev package-name
You can’t perform that action at this time.