Skip to content

Instantly share code, notes, and snippets.

@jamesantrobus
jamesantrobus / ghost2wp.py
Last active February 11, 2016 12:46 — forked from tzangms/ghost2wp.py
"""
Requirements:
* A Wordpress Blog
* Ghost export file (json).
* Python Packages: python-wordpress-xmlrpc
>>> pip install python-wordpress-xmlrpc
WARNING:
[TestFixture]
public class ControllerTests
{
[Test]
public void Foo()
{
CustomersController controller = new CustomersController().Testable()
.WithSession(Session)
.Authenticated(user => user.Foo = "bar");
@jamesantrobus
jamesantrobus / gist:7309441
Last active December 27, 2015 10:09
Liquid templating (Jekyll)
{{ "{% for post in site.posts" }} %}
<li>
<span>{{ "{{ post.date | date_to_string" }} }}</span>
<a href="{{ "{{ post.url" }} }}">{{ "{{ post.title" }} }}</a>
</li>
{{ "{% endfor" }} %}
@jamesantrobus
jamesantrobus / copy_to_remote_server.ps1
Created November 4, 2013 14:10
Copy file to remote server with PowerShell
$user = "\myusername"
$pass = ConvertTo-SecureString -String "supersecretpassword" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential
-ArgumentList $user ,$pass
New-PSDrive -Name myshare -PSProvider FileSystem -Root \\remoteserver\some-share -Credential $cred
Copy-Item C:\Users\James\test.txt myshare:\
@jamesantrobus
jamesantrobus / bootstrap.ps1
Created November 4, 2013 10:32
Bootstrap IIS with PowerShell
Set-ExecutionPolicy RemoteSigned
Import-Module WebAdministration
Function bootstrap($siteName, $hostHeader, $sitePath, $pipelineMode)
{
$site = Get-WebSite | where { $_.Name -eq $siteName }
if($site -eq $null)
{
echo "Creating site: $siteName"
{"nextId":null,"items":[{"title":"How to contribute to an open source project: look for TODOs in code","url":"http://ivanzuzak.info/2012/03/03/todos-ideas-for-contributing-to-open-source-projects.html","id":3660137,"commentCount":16,"points":127,"postedAgo":"3 hours ago","postedBy":"digitalnalogika"},{"title":"Research in programming languages","url":"http://tagide.com/blog/2012/03/research-in-programming-languages/","id":3660417,"commentCount":5,"points":23,"postedAgo":"1 hour ago","postedBy":"ltratt"},{"title":"The iPad is the new IE6","url":"http://blog.millermedeiros.com/ipad-is-the-new-ie6/","id":3660424,"commentCount":15,"points":35,"postedAgo":"1 hour ago","postedBy":"chewxy"},{"title":"Export to HTML5 from Flash Professional","url":"http://blogs.adobe.com/creativelayer/2012/02/28/html5-flash-professional/","id":3660341,"commentCount":8,"points":24,"postedAgo":"1 hour ago","postedBy":"kevinwdavid"},{"title":"Javascript libraries for animation in HTML5","url":"http://createjs.com/","id":3660445,"comment
@jamesantrobus
jamesantrobus / RMagick
Created April 12, 2011 23:29
Console output from RMagic install
sudo port install tiff -macosx imagemagick +q8 +gs +wmf
Password:
---> Computing dependencies for tiff
---> Dependencies to be installed: jpeg
---> Fetching jpeg
---> Attempting to fetch jpegsrc.v8c.tar.gz from http://lil.fr.distfiles.macports.org/jpeg
---> Verifying checksum(s) for jpeg
---> Extracting jpeg
---> Configuring jpeg
---> Building jpeg
void HideKeyboardForTextField(UITextField textField)
{
textField.ResignFirstResponder();
}
@jamesantrobus
jamesantrobus / StringUtils.cs
Created February 14, 2011 21:51
Newtonsoft.Json StringUtils
Newtonsoft.Json StringUtils line 353
public static TSource ForgivingCaseSensitiveFind<TSource>(this IEnumerable<TSource> source, Func<TSource, string> valueSelector, string testValue)
{
if (source == null)
throw new ArgumentNullException("source");
if (valueSelector == null)
throw new ArgumentNullException("valueSelector");
var caseInsensitiveResults = source.Where(s => string.Compare(valueSelector(s), testValue, StringComparison.OrdinalIgnoreCase) == 0);
GetUtcOffSet - JsonConvert.cs Line 111
private static TimeSpan GetUtcOffset(DateTime dateTime)
{
#if SILVERLIGHT
return TimeZoneInfo.Local.GetUtcOffset(dateTime);
#else
return TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
#endif
}