Skip to content

Instantly share code, notes, and snippets.

View talves's full-sized avatar
☠️
Coding

Tony Alves talves

☠️
Coding
View GitHub Profile
@talves
talves / wp-setup.php
Last active September 7, 2016 15:53
A Wordpress mu-plugin for use with composer using [roots](https://github.com/roots/roots) to setup the correct paths for a custom path. Modified `upload_url_path` to work on a windows IIS Server. Change to `/media` when needed.
<?php
if (!is_blog_installed()) { return; }
$my_server_port = ((!empty ($_SERVER ['SERVER_PORT']) AND $_SERVER ['SERVER_PORT'] <> '80') ? (":" . $_SERVER ['SERVER_PORT']) : '');
$my_server_name = (!empty ($my_server_port) ?($_SERVER['SERVER_NAME'] . $my_server_port) : $_SERVER['SERVER_NAME'] );
if ('http://' . $my_server_name . '/wp' == get_option('home')) {
update_option('siteurl', 'http://' . $my_server_name . '/wp');
update_option('home', 'http://' . $my_server_name);
update_option('upload_path', $_SERVER['DOCUMENT_ROOT'] . '\media');
@talves
talves / keybase.md
Created February 9, 2016 21:28
keybase.md

Keybase proof

I hereby claim:

  • I am talves on github.
  • I am talves (https://keybase.io/talves) on keybase.
  • I have a public key ASD6fOG65lyWkvDm4hBqJdPp7bAXJTF6WkB8h-trFITmrgo

To claim this, I am signing this object:

@talves
talves / razor_recursion_kooboo.cshtml
Created January 16, 2014 07:19
Razor code for Multi Menu Recursion
<div class="container">
<ul class="main-Menu">
@foreach (var item in MenuHelper.Top())
{
@ShowTree(item);
}
</ul>
</div>
@helper ShowTree(Kooboo.CMS.Sites.Models.Page item) {
/* css hover version of .dropdown */
.dropdown-hover {
.dropdown ();
&:hover {
> .dropdown-menu {
display: block;
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@talves
talves / UserAccountService.cs
Created November 23, 2013 00:11
MembershipReboot UserAccountService.cs UserAccountValidator.cs
/*
* Copyright (c) Brock Allen. All rights reserved.
* see license.txt
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@talves
talves / Wordpress web.config
Created November 5, 2013 21:45
A Wordpress IIS7+ minimum web.config for rewriting urls
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
@talves
talves / Web.Config
Created August 4, 2013 20:01
Code to fix Hosting server Using DPAPI session tokens by default
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="false" />
<serviceCertificate>
<certificateReference x509FindType="FindBySubjectName" findValue="localhost" storeLocation="LocalMachine" storeName="My" />
</serviceCertificate>
</federationConfiguration>
</system.identityModel.services>
@talves
talves / SlideData.js
Created May 5, 2015 19:05
SlideShow SlideData fix
define(function(require, exports, module) {
var SlideData = {
picasaUrl: 'https://picasaweb.google.com/data/feed/api/all',
queryParams: '?kind=photo&q=puppy&max-results=5&imgmax=720&alt=json',
defaultImage: ''
};
SlideData.getUrl = function() {
return SlideData.picasaUrl + SlideData.queryParams;
};