Skip to content

Instantly share code, notes, and snippets.

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

Javier Guerrero javierguerrero

🏠
Working from home
View GitHub Profile
<div id="hidden_form_container" style="display:none;"></div>
var app = angular.module('myApp', []);
function Ctrl1($scope) {
$scope.toto = function(){
alert('toto');
};
$scope.titi = function(){
<div ng-app='app' class="filters_ct" ng-controller="selectFilter">
<ul>
<li ng-repeat="filter in filters" ng-click="select($index)" ng-class="{sel: $index == selected}">
<span class="filters_ct_status"></span>
{{filter.time}}
</li>
</ul>
</div>
@javierguerrero
javierguerrero / gist:9f0b7042f02e7c953e8d
Created May 7, 2015 16:48
CAML – Query Lookup Field by ID; not by Value
<Query>
<Where>
<Eq>
<FieldRef Name="Area" LookupId="TRUE" />
<Value Type="Lookup">10</Value>
</Eq>
</Where>
</Query>
$.when( getTweets('austintexasgov'),
getTweets('greenling_com'),
getTweets('themomandpops')
).done(function(atxArgs, greenlingArgs, momandpopsArgs){
var allTweets = [].concat(atxArgs[0]).concat(greenlingArgs[0]).concat(momandpopsArgs[0]);
var sortedTweets = sortTweets(allTweets);
showTweets(sortedTweets);
});
var getTweets = function(user){
@javierguerrero
javierguerrero / gist:bde757f4feabb33da8b3
Created March 12, 2015 20:31
Comparing two arrays and getting the non duplicate(not unique) values
<script type="text/javascript">
var arr1=[1,2,3,4,5];
var arr2=[3,4,5,7,8,9,6];
$(document).ready(function(){
var arr=$(arr1).not(arr2).get();
alert(arr.length);
});
</script>
@javierguerrero
javierguerrero / gist:5a1408773967959d25cf
Created March 11, 2015 19:37
SPServices Hello World!
<script type="text/javascript">
alert ("js on.");
$(document).ready(function() {
alert ("jQuery on.");
var thisSite = $().SPServices.SPGetCurrentSite();
alert("Hello World! Your site is : " + thisSite);
});
</script>
<input type="radio" name="choice" value="1">choice1
<input type="radio" name="choice" value="2">choice2
<br />
<input id="autocomplete">
function createListItem() {
var clientContext = new SP.ClientContext(_spPageContextInfo.siteAbsoluteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('TestList');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
//Single line of text
oListItem.set_item('Title', 'My New Item!');
//Single Choice
@javierguerrero
javierguerrero / CSOM
Last active August 29, 2015 14:15
Changing the SharePoint Welcome Page Programmatically
ClientContext context = new ClientContext(webUrl);
Web web = context.Web;
context.ExecuteQuery();
Folder folder = web.RootFolder;
context.Load(folder);
folder.WelcomePage = "SitePages/MyCustomPage.aspx";
folder.Update();
context.ExecuteQuery();
//For other folder (e. g. Site Pages)