Skip to content

Instantly share code, notes, and snippets.

View netsi1964's full-sized avatar

Sten Hougaard netsi1964

View GitHub Profile
@netsi1964
netsi1964 / index.html
Created October 31, 2012 12:08
A CodePen by Sten Hougaard. Fork me on GitHub CSS - Here you have the setup to add a CSS based "Form me on Github" banner to your demoes of code stored on Gitbub.com
<body ng-app>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<h1>Fork me on GitHub CSS</h1>
</div>
</div>
<div class="row-fluid">
<blockquote>If you have some demo of some code which you are storing/sharing on GitHub, this codepen containes a codepattern for getting the Github banner as you can see it here in the top right.</blockquote>
@netsi1964
netsi1964 / gist:4028278
Created November 6, 2012 23:02
Dynamicweb: Is an iPaper being viewed?
Code to monitor if an iPaper is being viewed in a Dynamicweb soloution.
You can use CSS to add/hide CSS based features depending of the state of the iPaper being viewed or not.
Requires jQuery
(function($, window, undefined) {
// This code will add a class "showipaper" if an ipaper is being viewed
if (document.location.href.toLowerCase().indexOf('&showipaper')!=-1) {
$('html').addClass('showipaper');
};
@netsi1964
netsi1964 / gist:4030133
Created November 7, 2012 08:09
bookmarklet:Get link to google font "Orienta"
s = 'http://fonts.googleapis.com/css?family=Orienta';
l = '<link href="'+s+'" rel="stylesheet" type="text/css">';
c = '@import url('+s+');'
j = (!!!prompt('Style: [l]ink or [C]SS?', 'C').toUpperCase().indexOf('L')) ? l : c;
prompt('Here you go font\nOrienta:', j);
Bookmarklet:
javascript:(function() {s="http://fonts.googleapis.com/css?family=Orienta";l='<link href="'+s+'" rel="stylesheet" type="text/css">';c="@import url("+s+");";j=!!!prompt("Style: [l]ink or [C]SS?","C").toUpperCase().indexOf("L")?l:c;prompt("Here you go font\nOrienta:",j)})()
@netsi1964
netsi1964 / BaseCamp_analyzeComments.js
Created November 9, 2012 13:07
javascript:Base camp comment analyze
var comments = [];
var currentDate, aPersons=[], iPeople = 0;
var one_day=1000*60*60*24
var iDays = 0;
var today;
var sHTML = '<h6>'+jQuery('.item').text()+'</h6><div class="dialogue">';
function add(s, gone, person, date) {
var className= person.replace(/[ æøåÆØÅ]/ig, '');;
if (typeof aPersons[className]==='undefined') {
aPersons[className] = 1;
@netsi1964
netsi1964 / ItemType_AllFieldTypes.xsd
Created November 13, 2012 08:14
Dynamicweb ItemTypes Schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- http://www.java2s.com/Code/XML/XML-Schema/Attributebasedonsimpletypewithrestrictionandenumeration.htm -->
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:element name="item">
<xs:complexType>
@netsi1964
netsi1964 / QueryStringSettings.js
Created November 18, 2012 11:18
javascript simple web app state reflection using location - QueryStringSettings
var QueryStringSettings = {
selector: '[ng-model]:not([type="checkbox"])',
doneCallback: null,
set: function() {
var h = '';
[].forEach.call(document.querySelectorAll(this.selector), function(e) {
h += ((h !== '') ? '/' : '') + e.id + '=' + e.value;
});
document.location.hash = h;
if (this.doneCallback!==null) {
@netsi1964
netsi1964 / bookmarklet_cookiesInWindow.js
Last active December 27, 2018 01:52
Bookmarklet:Open window with cookie information
!function(){var t="Click to read information about this cookie",e="Cookies found on "+document.location.host,o="<style>body{font-family: monospace ;}</style><h1>"+e+"</h1><table><thead><tr><td>Name</td><td>Value</td></tr></thead><tbody>",a=document.cookie||"",a=a.split(";"),i="";[].forEach.call(a,function(e){var o=e.split("=");try{na=o[0].replace(/\s/gi,""),va=o[1].replace(/\s/gi,""),i+='<tr><td><a href="http://google.com/?q='+na+'" target="_blank" title="'+t+'">'+na+"</a></td><td>"+va+"</td></tr>"}catch(a){}}),0===i.length?alert("No cookies found"):(i+="</tbody></table>",w=window.open(""),setTimeout(function(){w.document.title=e},1e3),w.document.write(o+i+'<h2>Original</h2><textarea style="width: 100%; height: 100px;">'+document.cookie+"</textarea>"))}();
@netsi1964
netsi1964 / bookmarklet_add_jquery.js
Created November 21, 2012 12:08
Bookmarklet:Add jQuery to page
javascript:if (!!!window.jQuery) {var d=document;var s=d.createElement('script');s.src='http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js';d.body.appendChild(s);void(alert('added jQuery 1.7.2'))}else {;void(alert('allready using jQuery '+jQuery.fn.jquery))}
// Hack: Remove 3rd dropdown level
jQuery('a.L1').each(function() {
var $this = jQuery(this);
var submenuID = $this.attr('onmouseover').match(/\(.*\)/ig)[0].split(';')[0].replace(/\D/ig,'');
var L2 = jQuery('#submenu'+submenuID)
L2.find('[onmouseover]').attr({'onmouseover':'', 'onmouseout':''})
L2.find('img[src="Files/DropdownArrow.gif"]').remove();
});
@netsi1964
netsi1964 / removeBlackBorderFromAREAInMSIE.html
Created November 23, 2012 11:29
javascript:Remove black border on AREA when click in MSIE
<script type="text/javascript">
(function() {
var div = document.createElement('div');
div.innerHTML = '<!--[if IE]><i></i><![endif]-->';
var isIE = (div.getElementsByTagName('i').length === 1);
var areas = document.getElementsByTagName('area');
if (areas.length>0 && (isIE)) {
function removeBorder(e) {
this.blur();