Skip to content

Instantly share code, notes, and snippets.

View akras14's full-sized avatar

Alex akras14

  • Stevenson Ranch, CA
View GitHub Profile
(function(){
function getViewportWidth() {
var e = window;
var a = 'inner';
if (!( 'innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return e[ a + 'Width' ];
}
@akras14
akras14 / jsbin.zapok.html
Created March 13, 2014 02:39
Basic Knockout Demo
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
var Q = require('q');
var FS = require('fs');
var test = function(){
var deferred = Q.defer();
FS.readFile("foo.txt", "utf-8", function (error, text) {
if (error) {
deferred.reject(25);
} else {
deferred.resolve(text);
@akras14
akras14 / 0_reuse_code.js
Created April 20, 2014 19:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@akras14
akras14 / ask.js
Created April 25, 2014 18:07
Get user input and output from command line in NodeJs http://st-on-it.blogspot.com/2011/05/how-to-read-user-input-with-nodejs.html
function ask(question, format, callback) {
var stdin = process.stdin, stdout = process.stdout;
stdin.resume();
stdout.write(question + ": ");
stdin.once('data', function(data) {
data = data.toString().trim();
if (format.test(data)) {
@akras14
akras14 / ReadMe.md
Last active August 29, 2015 14:00
http://nodeschool.io/ Stream Adventure - HTML Stream Solution

The Problem

Your program will get some html written to stdin. Convert all the inner html to upper-case for elements with a class name of "loud".

You can use trumpet and through to solve this adventure.

With trumpet you can create a transform stream from a css selector:

var trumpet = require('trumpet');

Git Cheat Sheet

Commands

Getting Started

git init

or

@akras14
akras14 / .gitignore
Created November 13, 2016 23:10 — forked from jbergler/.gitignore
Acestream on Mac
.vagrant
@akras14
akras14 / users.json
Last active January 1, 2018 18:48
Retweets-of-947193531206160385.json
[
[
"Nikolai Stoilov",
409878075
],
[
"\u26a1\ufe0f \ud835\udc71\ud835\udc86\ud835\udc8f \ud835\udc7a\ud835\udc95\ud835\udc93\ud835\udc8a\ud835\udc84\ud835\udc8c\ud835\udc8d\ud835\udc82\ud835\udc8f\ud835\udc85 \u26a1\ufe0f",
39507585
],
[
First Name Last Name Date of Birth
Tom Cruise July 3, 1962
Bruce Willis March 19, 1955
Morgan Freeman June 1, 1937
John Wayne May 26, 1907