This file contains hidden or 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
const glob = require('glob'); | |
const jsFiles = glob.sync('src/**/*.js'); | |
const tsFiles = glob.sync('src/**/*.ts'); | |
const tsxFiles = glob.sync('src/**/*.tsx'); | |
const allTsFiles = tsFiles.concat(tsxFiles); | |
console.log(`There are ${jsFiles.length} .js files in the 'src' directory.`); | |
console.log(`There are ${allTsFiles.length} .ts/x files in the 'src' directory.`); | |
console.log(`${Math.round((allTsFiles.length / jsFiles.length) * 100)}% of the files are TypeScript files.`); |
This file contains hidden or 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
/** | |
* Opens a new browser window | |
* @param {String} url The url of the window to open | |
* @param {String} name The name of this window | |
* @param {Number} width Window width | |
* @param {Number} height Window height */ | |
const PopUpWindow = (url, name, width, height)=> { | |
// Center the window | |
let _width = width || 450, | |
_height = height || 300, |
This file contains hidden or 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
// This uses Google tracking as an example | |
var interval = setInterval(function () { | |
console.log('searching..') | |
if (window._gaq) { | |
_gaq.push(['_trackPageview', 'Something']); | |
clearInterval(interval); | |
console.log('stop'); | |
} | |
}, 10); |
This file contains hidden or 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
void setup() { | |
system("telnetd -l /bin/sh"); | |
system("echo setup > /dev/ttyGS0"); | |
} | |
void loop() { | |
// Original code that prints out all data: | |
// system("ifconfig eth0 > /dev/ttyGS0"); | |
// Modified code to search for "inet addr" and print out the address | |
system("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' > /dev/ttyGS0"); | |
// Sleep is used here like the "delay" function to continuously print out the address for us. |
This file contains hidden or 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
Thank you for considering me for this role. | |
Unfortunately, I am not looking for any new opportunities at the moment. | |
I'll be sure to pass this along to anyone I run into that would fit this position. | |
Respectfully, | |
<name> |
This file contains hidden or 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 genPrimes(min, max){ | |
var isPrime, primes = []; | |
for (var i = min; i <= max; i++) { | |
isPrime = true; | |
for (var j = min; j * j <= i; j++) { | |
if (i % j === 0) { | |
isPrime = false; | |
break; | |
} | |
} |
This file contains hidden or 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
/* source: all over the interwebz */ | |
/*------------------------ Smartphones ------------------------ */ | |
/* Portrait & Landscape */ | |
@media only screen | |
and (min-width : 320px) | |
and (max-width : 480px) { | |
/* styles */ | |
} | |
/* Landscape */ |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://static.jquery.com/ui/css/base2.css" type="text/css" media="all" /> | |
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/blitzer/jquery-ui.css" type="text/css" media="all" /> | |
<!--http://ajax.googleapis.com/ajax/libs/jqueryui/[UI.VERSION]/themes/[THEME-NAME]/jquery-ui.css--> | |
</head> | |
<body> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script> |
This file contains hidden or 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 ellipsis(numOfWords, text, wordCount ) { | |
wordCount = text.trim().replace(/\s+/g, ' ').split(' ').length; | |
if(numOfWords <= 0 || numOfWords === wordCount){ | |
return text; | |
} else { | |
text = text.trim().split(' '); | |
text.splice(numOfWords, wordCount, '...'); | |
return text.join(' '); | |
} | |
} |
NewerOlder