Skip to content

Instantly share code, notes, and snippets.

View netsi1964's full-sized avatar

Sten Hougaard netsi1964

View GitHub Profile
@netsi1964
netsi1964 / README.md
Last active June 7, 2016 19:44
Peeking around the Apple MapKit javascript object

Get a JSON version of any browser object

Version 0.82

I am a curious sole, and when I saw that Apple had a map I wanted to see the API of it (at the time of writing it is not official). I wrote this litle script which should be executed in the developer toolbar. It allows you to get json object of the properties, functions, methodes an structur of any javascript object.

Please do use it and please put GISTs of the objects you convert to JSON. May I suggest that you name them the name that is autogenerated from the script.

mapkit becomes mapkitAsJSON.json

Share your JSON objects with #asjson

@netsi1964
netsi1964 / getArgs.js
Created May 13, 2016 09:40
Simple Node.js module to get process arguments
function getArgs() {
var argv = process.argv.join(' ');
var result = {}; // reset
for (
argv = argv.split(/\s*\B[\/-]+([\w-]+)[\s=]*/),
i = 1; item = argv[i++]; result[item] = argv[i++]
);
return result;
}
@netsi1964
netsi1964 / README.md
Last active May 1, 2016 08:27
Basic send e-mail using ASP.net and C# from an Unoeuro account

Basic send e-mail using ASP.net and C# from an Unoeuro account

If you have an ASP.NET based UnoEuro account, these two files sendEmail.aspx and web.config can be the basic for a simple send e-mail pags.

Setting up to your needs

  • Change all the relevant custom properties found in the two files
  • Customize the content of the send e-mail, and onscreen responses
  • Change the URL of the sendEmail.aspx to fit your need
  • Upload to your unoeuro website using FTP
@netsi1964
netsi1964 / KeyCode.js
Created April 23, 2016 07:25
Adds KeyCode global object with shortcuts to known javascript keycode event codes
window.KeyCode = (window.KeyCode) ? window.KeyCode : {
CANCEL: 3,
HELP: 6,
BACK_SPACE: 8,
TAB: 9,
CLEAR: 12,
RETURN: 13,
ENTER: 14,
SHIFT: 16,
CONTROL: 17,
@netsi1964
netsi1964 / addSendOnEnterToChat.js
Created March 9, 2016 08:01
Add send on enter to chat
$(function() {
var eleMessage = document.querySelector("#message"),
eleSendButton = document.querySelector("#sendButton");
eleMessage.addEventListener('keyup', function(evt) {
if (evt.which === 13) {
eleSendButton.click();
}
})
})
@netsi1964
netsi1964 / Examples.md
Last active February 22, 2016 09:36
Find longest CSS class name on site

Find longest CSS class name on site

Copy the code inside congestCSS.js and run it in the developer console. You get some information about the longest class used on the website.

Examples

The longest classname is 516 chars long, contains 32 CSS classes

The longest classname is 43 chars long, contains 5 CSS classes

@netsi1964
netsi1964 / screenshoot.js
Created February 19, 2016 22:38
Simple screenshoot script for PhantomJS
var page = require('webpage').create();
//viewportSize being the actual size of the headless browser
page.viewportSize = { width: 1024, height: 768 };
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: 0, left: 0, width: 1024, height: 768 };
//the rest of the code is the same as the previous example
page.open('http://www.netsi.dk/wordpress', function() {
page.render('netsi.png');
phantom.exit();
});
@netsi1964
netsi1964 / snippets.cson
Created February 1, 2016 09:13
Usefull Atom snippets
'.source.gfm':
'|':
'prefix': 'iii'
'body': ' | '
@netsi1964
netsi1964 / Atom__staredpackages--toMarkdown.js
Last active January 19, 2016 10:33
Create MarkDown list of your starred packages
var packages = "Package | Description | Downloaded \n:--|:---|--:\n";
base = "https://atom.io/packages";
Array.prototype.forEach.call(document.querySelectorAll(".package-card.card"), function(e) {
var name = e.querySelector(".css-truncate-target a");
var nameLink = base+name.getAttribute("href");
var nameText = name.innerText;
var description = e.querySelector(".css-truncate-target.card-description").innerText;
var downloaded = e.querySelector(".stat .value").innerText;
packages+="["+nameText+"]("+nameLink+") | "+description+" | "+downloaded+"\n";
});
@netsi1964
netsi1964 / Building a calendar.markdown
Created January 5, 2016 08:27
Building a calendar

Building a calendar

I wanted to exercise my raw javascript and css - no Bootstrap, no jQuery, no AngularJS - all by myself. So here goes: A calendar build using basic* web technologi. *) I however used SCSS, trying to create the css faster and more flexible.

A Pen by Sten Hougaard on CodePen.

License.