Skip to content

Instantly share code, notes, and snippets.

@mirontoli
mirontoli / Modernizr placeholder
Created March 25, 2012 22:50 — forked from athanassiadis/Modernizr placeholder
Modernizr placeholder
if (!Modernizr.input.placeholder){
$('input[type=text]').each( function(){
$(this).attr('value', $(this).attr('placeholder') )
.focus(function(){
var ph = $(this).attr('value');
$(this).attr('value','')
.blur( function(){
if($(this).attr('value').length < 1 ){
$(this).attr('value', ph);
}
@mirontoli
mirontoli / geo.html
Created May 12, 2012 06:58
geolocation test
<!DOCTYPE html>
<!-- Comes from http://zeeshanakhter.com/2012/03/15/find-out-your-visitors-position-using-html5-geolocation/ -->
<html>
<head>
<title>HTML5 Geolocation</title>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
// Integration with google maps
function loadMap(lat, lng) {
var latlng = new google.maps.LatLng(lat, lng);
@mirontoli
mirontoli / addScript.js
Last active October 4, 2015 19:48
sharepoint cdn js template
/*
* Anatoly Mironov http://sharepointkunskap.wordpress.com, http://www.bool.se
* Use this script to add your js files to your page in the console dynamically
* Don't use it in the production, just for testing
*/
function addScript(url) {
var script = document.createElement("script");
script.setAttribute("type","text/javascript");
//Conditionally load jQuery
//inspired by http://www.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/
function myOnLoadEvent() {
jQuery(document).ready(function($) {
alert('your code here');
});
}
@mirontoli
mirontoli / fancybox-resize.js
Created July 3, 2012 06:12
fancybox resize
function adjustHeight() {
if (window.parent && window.parent.jQuery) {
var content = jQuery("#content");
if (content) {
var height = content.height() + 1;
window.parent.jQuery("#fancybox-content").height(height);
}
}
}
jQuery(window).load(adjustHeight);
@mirontoli
mirontoli / LoginManager.java
Created September 11, 2012 23:25
SharePoint Online Java Login
package spauth;
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import org.w3c.dom.Document;
import org.xml.sax.*;
public class LoginManager {
@mirontoli
mirontoli / lang.js
Last active November 3, 2023 15:15
Get Language name based on iso 639-1 code
/**
* @author Anatoly Mironov (mirontoli)
* http://sharepointkunskap.wordpress.com
* http://www.bool.se
*
* http://stackoverflow.com/questions/3605495/generate-a-list-of-localized-language-names-with-links-to-google-translate/14800384#14800384
* http://stackoverflow.com/questions/10997128/language-name-from-iso-639-1-code-in-javascript/14800499#14800499
*
* using Phil Teare's answer on stackoverflow
* http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304
@mirontoli
mirontoli / Web.config.xml
Created February 11, 2013 09:50
Windows authentication for WCF
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
<authentication mode="Windows"/>
<authorization>
<allow users="CONTOSO\lightning"/>
@mirontoli
mirontoli / app.js
Created February 23, 2013 22:48
Angular UI autocomplete example
var autocompleteApp = angular.module("autocompleteApp");
var autocompleteController = function($scope) {
//http://jqueryui.com/autocomplete/
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
@mirontoli
mirontoli / markup.html
Created March 25, 2013 22:23
A todo webpart markup for SharePoint 2010 which uses the REST API (listdata.svc) to create, update, list and delete todos from the list Tasks. It only works in Norwegian language, because it is on of the limitations of the REST API in SharePoint 2010. This code was written for a while and uses the deprecated jQuery tmpl for rendering the todos.
<style type="text/css">
/***************************************************
Marvelous Formula (MF) WPTodo
******************************************************/
#todo-wp {
max-height: 400px;
/* todo overflow: auto or pagination */
overflow-y: auto;
}
#todo-wp .header {