Skip to content

Instantly share code, notes, and snippets.

View asciidisco's full-sized avatar
🏠
Working from home

Sebastian Golasch asciidisco

🏠
Working from home
View GitHub Profile
@asciidisco
asciidisco / dalek_random.js
Created July 9, 2014 14:34
Fetching a random element
'use strict':
var randomPickMe = function (arr) {
return arr[Math.floor((Math.random()*arr.length))];
};
var elements = ['div', 'p', '.someClass', '#anid', 'span a'];
module.exports = {
'use strict';
module.exports = {
'Can move data around': function (test) {
test.open('http://localhost:5001/about.html')
// executed in browser scope
.execute(function () {
var message = Math.random().toString(36).substring(7);
this.data('lastMessage', message);
@asciidisco
asciidisco / gruntfile.js
Created October 29, 2014 12:53
grunt-sass multifile
sass: {
dist: {
files: {
'src/css/main.css': 'src/scss/main.scss',
'src/css/main2.css': 'src/scss/main2.scss'
}
}
},
@asciidisco
asciidisco / jnpm
Created December 10, 2014 12:07
jQuery NPM Package Contents
|-- AUTHORS.txt
|-- CONTRIBUTING.md
|-- MIT-LICENSE.txt
|-- README.md
|-- bower.json
|-- dist
| |-- cdn
| |-- jquery.js
| |-- jquery.min.js
| `-- jquery.min.map
@asciidisco
asciidisco / js-iot.md
Last active August 29, 2015 14:16
Tales from the crypt: JavaScript & the Internet of Things

Tales from the crypt: JavaScript & the Internet of Things

Let`s face the truth, "The Internet of Things" (or IoT like the all the cool cats say) isn't more than a fancy buzzword. Interestingly though, it is used by two different groups of people, one wants to "shove big data into the cloud" and the other group builds DIY software & hardware to control their coffee machine using a Tessel backed up by an Raspberry PI.

If we dive deeper into this topic, looking for a common ground both groups build upon, we see the same questions bubbling up: Is my battery powered motion detector really connected to the internet? If all these devices belong to the category "Internet of Things", why do I need a vendor specific access point to control them? Does my cloudy big data lightbulb producer know when I turn on the lights? And very important: Why doesn't this "Internet of Things" work in my browser? Do I really need 20 iPhone apps to turn stuff on and off?

On the meta level, all these questions could be answered wi

@asciidisco
asciidisco / chat.js
Created December 2, 2011 15:13
NodeChat
// Module dependencies.
var express = require('express')
, stylus = require('stylus')
, nib = require('nib')
, sio = require('socket.io')
, app = null;
// Create application server
app = express.createServer();
@asciidisco
asciidisco / cssminex
Created June 3, 2012 10:02
CSSMin example
cssmin: {
build: {
src: ['src/css/boilerplate_top.css', 'src/css/ui/jquery.ui.base.css', 'src/css/ui/jquery.ui.theme.css', , 'src/css/ui/jquery.ui.slider.css', 'src/css/ui/jquery.ui.core.css', 'src/css/jquery.jscrollpane.css', 'src/css/screen.css', 'src/css/slider.css', 'src/css/boilerplate_bottom.css'],
dest: 'build/css/main.css'
}
},
min : {
build: {
src: ['src/js/jquery.js', 'src/js/plugins.js'],
dest: 'build/js/all.js'
@asciidisco
asciidisco / ga.txt
Created September 10, 2012 09:09
Grunt absract
Nowadays frontend developers have to deal with topics & tools that they´ve never encountered before: unit testing, code linting, minification, code modularization, etc. ...
Those who done it know, setting everything up and maintaining it is a pain that costs
hours of working time.
But that´s not true anymore; thanks to Grunt, we now have a frontend specific build tool that eliminates most of hard work.
During this talk we will learn how to setup grunt, learn to use it in a real world project and discover it´s ecosystem with plenty of written plugins.
@asciidisco
asciidisco / pijs.js
Created September 10, 2012 18:25
"Privates" in JS
// Defining "private" properties in JavaScript
// define youre own scope by using an
// immediate executed function
(function (){
// x is only be visible within this scope a.k.a this function
var x = null;
var Bla = function(blup) {
@asciidisco
asciidisco / getTitle.js
Created January 31, 2013 16:19
Access PhantomJS via WebDriver/JSONWireProtocol from node to receive the title of a webpage
// before you launch this script, make sure you have phantomjs v1.8 installed
// and launch it with the port specified in the options: ´$ phantomjs --webdriver=3456´
var http = require('http');
// request body for "/wd/hub/session" request
var body = JSON.stringify({desiredCapabilities: {browserName: 'firefox', version: '', platform: 'ANY'}});
// base options for post requests
var options = {