Skip to content

Instantly share code, notes, and snippets.

View alvin-milton's full-sized avatar
🤠
yee haw

Alvin Milton alvin-milton

🤠
yee haw
  • New York
View GitHub Profile
@alvin-milton
alvin-milton / friends_and_fuckboys.coffee
Last active October 1, 2015 20:24
coffeescript splat, functions, parsing arrays, and fuckboys
peace = (a) ->
str = "what up, #{a}!"
console.log(str)
war = (a) ->
str = "You suck, #{a}!"
console.log(str)
shoutout = (a, b, c, toomany...) ->
peace a
<amp-iframe width="320" height="400" src="https://cache.vevo.com/assets/html/embed.html?video=USRV81501030&amp;autoplay=0" layout="responsive" sandbox="allow-scripts" class="-amp-element -amp-layout-responsive -amp-layout-size-defined -amp-layout" id="AMP_18">
<i-amp-sizer style="display: block; padding-top: 125%;"></i-amp-sizer>
<i-amp-scroll-container>
<iframe class="-amp-fill-content" width="320" height="400" name="amp_iframe0" sandbox="allow-scripts" src="https://cache.vevo.com/assets/html/embed.html?video=USRV81501030&amp;autoplay=0"></iframe>
</i-amp-scroll-container>
</amp-iframe>
@alvin-milton
alvin-milton / collect_npms.js
Created March 22, 2016 02:26
Collects NPM names into a list
var fs = require("fs");
function main() {
fs.readdir("./node_modules", function (err, dirs) {
if (err) {
console.log(err);
return;
}
dirs.forEach(function(dir){
if (dir.indexOf(".") !== 0) {
brew install node --without-npm
mkdir "${HOME}/.npm-packages"
echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc
echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc
curl -L https://www.npmjs.org/install.sh | sh
echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc
echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc
echo source "~/.bashrc" >> ${HOME}/.bash_profile
source ~/.bashrc
var i = 1;
for (i; i <= 100; i++) {
if ((i % 3 === 0) && (i % 5 === 0)) {
console.log('fizzbuzz');
} else if (i % 5 === 0) {
console.log('buzz');
} else if (i % 3 === 0) {
console.log('fizz');
} else {
@alvin-milton
alvin-milton / is_uiwebview.js
Last active May 12, 2016 17:33
is_uiwebview javascript
var is_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)
alert(is_uiwebview);
var ismobil,
date = new Date(),
expires,
nameEQ,
ca,
c,
i,
x,
redirectagent,
redirect_devices,
@alvin-milton
alvin-milton / math.js
Created May 13, 2016 15:31
Write a function accepts numbers as strings and adds them. Return them as strings.
function validateInput(a) {
var valid = a >= 0 ? a : false;
return valid;
}
function doIt(a, b) {
var arr = [],
i = 0,
x = parseInt(a, 10),
@alvin-milton
alvin-milton / index.html
Created November 21, 2016 20:41 — forked from anonymous/index.html
Post Landing page tech
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<pre>
===================