Skip to content

Instantly share code, notes, and snippets.

View ainsofs's full-sized avatar

Ainsof So'o ainsofs

View GitHub Profile
@ainsofs
ainsofs / gist:3f20173180478325f66e
Created April 16, 2015 21:25
Steps to update sh404 to perform 301 redirects on Joomla from the database
-- Steps to update sh404 to perform 301 redirects on Joomla from the database
-- 1. Search for your current url
select * from {owner}.{prefix}sh404sef_urls
where oldurl like '%{your old url}%'
order by oldurl
-- 2. Update the newurl to the new page you want
index.php?option=com_content&Itemid={menu item id}&id={article id}&lang=en&view=article
update {owner}.{prefix}sh404sef_urls
@ainsofs
ainsofs / gist:fc6674409025283c7d02
Created April 20, 2015 04:35
Convert Latin1 to UTF8 on MySQL
CONVERT(CAST(CONVERT(latin1_field USING latin1) AS BINARY) USING utf8)
-- more : http://jonisalonen.com/2012/fixing-doubly-utf-8-encoded-text-in-mysql/
@ainsofs
ainsofs / gist:f58256a5fd6b9cf4e6ad
Created April 22, 2015 02:17
Utility Classes that can be reused in multiple projects
public class PagedResult<T> {
public List<T> Items { get; set; }
public long CurrentPage { get; set; }
public long ItemsPerPage { get; set; }
public long TotalItems { get; set; }
public long TotalPages { get; set; }
public string Text { get; set; }
}
@ainsofs
ainsofs / gist:fd5954ebfa6a992fd5b8
Created April 26, 2015 21:14
Sample knockout script
(function () {
function Task(data) {
this.title = ko.observable(data.title);
this.isDone = ko.observable(data.isDone);
}
function TaskListViewModel() {
// Data
var self = this;
self.tasks = ko.observableArray([]);
@ainsofs
ainsofs / gist:f845eec0cc3829b73353
Created April 28, 2015 08:18
Jquery to prompt user to confirm that they want to leave the page
$(window).bind('beforeunload', function() {
var prompt = true; //if you dont return anything, the page will continue as normal
if (prompt)
return 'You have unsaved changes';
});
@ainsofs
ainsofs / gist:003595b971da9d45fb26
Created May 7, 2015 04:49
Updating Title, Suffix, Gender, Email Addresses, Physical Address (Home, Business and Other) in Exchanged Managed API
//taken from: http://stackoverflow.com/questions/13475674/updating-a-contact-with-ews
Contact updateContact = Contact.Bind(service, itemId);
updateContact.GivenName = customContact.Name;
updateContact.Surname = customContact.Surname;
EmailAddress emailAddress;
bool emailAddressFound;
emailAddressFound = updateContact.EmailAddresses.TryGetValue(EmailAddressKey.EmailAddress1, out emailAddress);
@ainsofs
ainsofs / ascx
Last active August 29, 2015 14:22
DNN Knockout Boiler Template
<!-- requires DNN 7.2 or higher -->
<%@ Register TagPrefix="dnn" TagName="JavaScriptLibraryInclude" Src="~/admin/Skins/JavaScriptLibraryInclude.ascx" %>
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<asp:Panel ID="ScopeWrapper" runat="server">
<!-- things to bind here -->
</asp:Panel>
<dnn:JavaScriptLibraryInclude runat="server" Name="knockout" version="3.1.0" />
<dnn:JavaScriptLibraryInclude runat="server" Name="knockout.mapping" version="2.4.1" />
git config --global url."https://".insteadOf git://
git config --global --unset url."https://".insteadOf
@ainsofs
ainsofs / gist:1cd158f02886cc51bf44
Created June 20, 2015 01:51
drush common modules
drush dl ckeditor
drush en -y ckeditor
drush ckeditor-download
drush make-generate [fileName].make
@ainsofs
ainsofs / gist:d45f7f8944309d61a721
Last active August 29, 2015 14:23
Setup Site Alias on Apache Ubuntu 12
#ubuntu 12
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/example.com
#ubuntu 14
sudo cp /etc/apache2/sites-available/000-default.config /etc/apache2/sites-available/example.com.config
sudo nano /etc/apache2/sites-available/example.com
ServerName example.com