Skip to content

Commit

Permalink
Generate static HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Apr 20, 2015
1 parent 3727f79 commit fdf85e6
Show file tree
Hide file tree
Showing 37 changed files with 840 additions and 708 deletions.
14 changes: 7 additions & 7 deletions 2013/01/21/cocoapods-how-to-create-your-own-pod.html
Expand Up @@ -4,11 +4,11 @@
The first step is to have something to make a pod of, I guess every developer has his own little set of smart methods that make his life easier. Don&#39;t be greedy, share them with the community!</p>
<p><h3>Step 2 - Tag your pod properly</h3>
Since we&#39;re gonna work with a dependency manager we need to take care of the version number of our pod.</p>
<pre><code class="">git <span class="hljs-built_in">tag</span> <span class="hljs-attribute">-a</span> <span class="hljs-number">1.0</span><span class="hljs-number">.0</span> <span class="hljs-attribute">-m</span> <span class="hljs-string">"Tag release 1.0.0"</span>
<pre><code class="">git tag -<span class="hljs-tag">a</span> <span class="hljs-number">1.0</span>.<span class="hljs-number">0</span> -m <span class="hljs-string">"Tag release 1.0.0"</span>
</code></pre><p>Take a couple of minutes to read through the <a href="http://semver.org/">Semantic Versioning</a> to learn how to use tagging for version numbers properly and in a way that allows for <a href="https://github.com/CocoaPods/Specs/wiki/Cross-dependencies-resolution-example">resolution of cross-dependencies</a>.</p>
<p><h3>Step 3 - The podspec</h3>
Once our project is tagged properly we can create the <code>.podspec</code> file. The extension name explains that it will contain the &quot;specs&quot; of our &quot;pod&quot;.</p>
<pre><code class="">pod spec <span class="hljs-operator"><span class="hljs-keyword">create</span> Donut</span>
<pre><code class="">pod spec create <span class="hljs-keyword">Do</span><span class="hljs-label">nut</span>
</code></pre><p>This will generate the <code>Donut.podspec</code> file.</p>
<p>You can also generate the <code>podspec</code> from a GitHub repo using the GitHub url instead of the name.</p>
<p><h3>Step 4 - Leave your mark on the podspec</h3>
Expand All @@ -33,12 +33,12 @@
{<span class="hljs-subst">%</span> endhighlight <span class="hljs-subst">%</span>}
</code></pre><p><h3>Step 5 - Is my podspec ok?</h3>
Once your <code>podspec</code> its ready validate it running</p>
<pre><code class="">pod spec lint Peanut<span class="hljs-preprocessor">.podspec</span>
<pre><code class=""><span class="hljs-title">pod</span> spec lint Peanut.podspec
</code></pre><p>If everything is fine you&#39;ll read</p>
<pre><code class="">pod spec lint Peanut.podspec
-<span class="ruby">&gt; <span class="hljs-constant">Peanut</span> (<span class="hljs-number">1.0</span>.<span class="hljs-number">0</span>)
</span>Analyzed 1 podspec.
Peanut.podspec passed validation.
<pre><code class="">pod spec lint Peanut<span class="hljs-class">.podspec</span>
-&gt; Peanut (<span class="hljs-number">1.0</span>.<span class="hljs-number">0</span>)
Analyzed <span class="hljs-number">1</span> podspec.
Peanut<span class="hljs-class">.podspec</span> passed validation.
</code></pre><p>Otherwise <code>pod spec</code> will explain the error or warning, as everything is so simple also fixing the problems will be. Anyway the error report is already formatted in <a href="http://daringfireball.net/projects/markdown/">Markdown</a> so you can copy it and paste it in an issue on the <a href="https://github.com/CocoaPods/CocoaPods/issues/new">CocoaPods Issues page</a>.</p>
<p><h3>Step 6 - Let your pod fly</h3>
We&#39;re almost done here. Now to make our pod available to the community, or just to ourselves and feel cool, we have two options. The rookie way is open an issue, but we&#39;ve just coded an iOS library, with it&#39;s own repo on GitHub, and generated the <code>podspec</code> fetching the data from there, so we&#39;re not rookies. The second option is to fork the <a href="https://github.com/CocoaPods/Specs">Specs repo</a>, add our pod, submit the PR and wait.</p>
Expand Down
Expand Up @@ -24,27 +24,27 @@ <h3 id="3-a-basic-login-flow">3 - A basic login flow</h3>
</ol>
<h4 id="check-if-the-user-is-logged-in">Check if the user is logged in</h4>
<p>To get the current Facebook session we use <code>FBSession.activeSession</code>. To see if the session is active, and therefore the user is already logged in, we need to check the <code>state</code> property: <code>FBSession.activeSession.state</code>. A quick look to the <code>typedef enum</code> of the <code>FBSessionState</code> and:</p>
<pre><code class="">{% highlight objective-c <span class="hljs-variable">%}</span>
<pre><code class="">{% highlight objective-c %}
+ (BOOL)isUserLoggedInFacebook
{
<span class="hljs-keyword">if</span> (FBSession.activeSession.<span class="hljs-keyword">state</span> == FBSessionStateCreatedTokenLoaded
if (FBSession.activeSession.<span class="hljs-keyword">state</span> == FBSessionStateCreatedTokenLoaded
|| FBSession.activeSession.<span class="hljs-keyword">state</span> == FBSessionStateOpen
|| FBSession.activeSession.<span class="hljs-keyword">state</span> == FBSessionStateOpenTokenExtended) {
<span class="hljs-keyword">return</span> YES;
} <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">return</span> NO;
return YES;
} else {
return NO;
}
}
{% endhighlight <span class="hljs-variable">%}</span>
{% endhighlight %}
</code></pre><h4 id="call-the-facebook-sdk-method-to-login">Call the Facebook SDK method to login</h4>
<p>Easy peasy:</p>
<pre><code class="">{% highlight objective-c %}
[FBSession openActiveSessionWithReadPermissions:<span class="hljs-literal">nil</span>
allowLoginUI:<span class="hljs-literal">YES</span>
completionHandler:^(FBSession *session, FBSessionState state, <span class="hljs-built_in">NSError</span> *error) {
<span class="hljs-comment">// handle stuff here</span>
}];
{% endhighlight %}
<pre><code class=""><span class="hljs-collection">{% highlight objective-c %}</span>
<span class="hljs-collection">[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:^<span class="hljs-list">(<span class="hljs-keyword">FBSession</span> *session, FBSessionState state, NSError *error)</span> <span class="hljs-collection">{
// handle stuff here
}</span>]</span><span class="hljs-comment">;</span>
<span class="hljs-collection">{% endhighlight %}</span>
</code></pre><p>In the completion handler we should… handle the result of the open active session. I think that this really depends on what our app will do, so I&#39;m not gonna write any snippet here.</p>
<h4 id="come-back-to-the-app-and-handle-the-result">Come back to the app and handle the result</h4>
<p>If you&#39;re user&#39;s are using iOS 5 -I hope they&#39;re not-, or if they&#39;re so dumb they haven&#39;t installed the native Facebook app for iOS, the login will occur with a sort of modal window in your app. In all the rest of the cases the</p>
Expand Down
6 changes: 3 additions & 3 deletions 2013/07/09/cocoapods-the-inherited-flag.html
@@ -1,8 +1,8 @@
<!DOCTYPE html><html lang="en"><head><title>CocoaPods: the $(inherited) flag | mokacoding</title><meta name="description" content="A self memo on how to set the $(inherited) flag on a project using CocoaPods on Xcode."><link href="/css/griddy.css" rel="stylesheet"><link href="/css/style.css" rel="stylesheet"><link href="/css/font-awesome.min.css" rel="stylesheet"><link href="/css/zenburn.css" rel="stylesheet"><link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css"><link href="/css/mailchimp-form-override.css" rel="stylesheet"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"></head><body><div class="page"><div class="row-12"><div class="col-12 header"><h1 class="brand"><a href="/">mokacoding</a></h1><div class="punchline">unit and acceptance testing, automation, productivity</div><div class="links"><a href="/archive.html">Archive</a><a href="/tags.html">Tags</a><a href="http://giovannilodi.com">About</a><a href="#subscribe">Subscribe</a></div></div><div class="col-12"><div class="post-container"><h2 class="post-title"><a href="/blog/cocoapods-the-inherited-flag">CocoaPods: the $(inherited) flag</a></h2><p class="post-meta"><span class="post-date">Tue Jul 09 2013&nbsp;</span><a href="/tag/CocoaPods/index.html" class="post-tag">-CocoaPods</a><a href="/tag/iOS/index.html" class="post-tag">-iOS</a></p><div class="post"><p>I&#39;ve done it a lot of times by now, but I keep forgetting it. So here&#39;s a quick post to commit it to memory!</p>
<p>If we have a project with the Tests target it can happen that after running <code>pod install</code> we get this message:</p>
<pre><code class="">[!] The target <span class="hljs-smartquote">`MyProjectTests [Debug]` overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Pods-MyProjectTests.xcconfig'</span>.
<span class="hljs-bullet">- </span>Use the <span class="hljs-code">`$(inherited)`</span> flag, or
<span class="hljs-bullet">- </span>Remove the build settings from the target.
<pre><code class="">[!] The target <span class="hljs-escape">`M</span>yProjectTests [Debug]<span class="hljs-escape">` </span>overrides the <span class="hljs-escape">`F</span>RAMEWORK_SEARCH_PATHS<span class="hljs-escape">` </span>build setting defined in <span class="hljs-escape">`P</span>ods/Pods-MyProjectTests.xcconfig'.
- Use the <span class="hljs-escape">`$</span>(inherited)<span class="hljs-escape">` </span>flag, <span class="hljs-literal">or</span>
- Remove the build settings from the target.
</code></pre><p>How can we &quot;use the $(inherited) flag&quot;? Where should we add it?</p>
<p>The <code>$(inherited)</code> flag is an flag we can pass to the linker and that <em>does some magic...</em>. I haven&#39;t been able to find a proper explanation for how <code>$(inherited)</code> works, although it&#39;s easy to guess from the name.</p>
<p>Being a linker flag we can add it in our target Build Settings &gt; Other Linker Flags section.</p>
Expand Down
10 changes: 5 additions & 5 deletions 2013/09/16/xcode5-crash-on-submission.html
Expand Up @@ -5,8 +5,8 @@ <h4 id="step-1">Step 1</h4>
<p>Make sure all the provisioning profiles and code signing are set properly</p>
<h4 id="step-2">Step 2</h4>
<p>Open your Terminal and generate the <code>.ipa</code> yourself, with the help of <a href="https://github.com/nomad/shenzhen">shenzhen</a>.</p>
<pre><code class="">cd my/ready/<span class="hljs-keyword">to</span>/be/submitter/ios/project
ipa build -c <span class="hljs-keyword">Release</span>
<pre><code class="">cd my<span class="hljs-regexp">/ready/</span>to<span class="hljs-regexp">/be/</span>submitter<span class="hljs-regexp">/ios/</span><span class="hljs-keyword">project</span>
ipa build -c Release
</code></pre><h4 id="step-3">Step 3</h4>
<p>Upload the app through Application Loader.</p>
<h4 id="step-4">Step 4</h4>
Expand All @@ -28,10 +28,10 @@ <h3 id="the-tragic-message">The tragic message</h3>
<p><img src="http://mokacoding.s3.amazonaws.com/2013-09-16-the-terrible-dialog.jpg" alt="The terrible dialog"></p>
<p>And guess what? Both those buttons resulted in Xcode crashing, right there, with no explanation, no progress bar, nothing, Boom!</p>
<p>Out of curiosity I opened the crash log that got generated and…</p>
<pre><code class="">Crashed <span class="hljs-keyword">Thread</span>: <span class="hljs-number">0</span> Dispatch <span class="hljs-built_in">queue</span>: com<span class="hljs-built_in">.</span>apple<span class="hljs-built_in">.</span>main<span class="hljs-attribute">-thread</span>
<pre><code class="">Crashed <span class="hljs-string">Thread:</span> <span class="hljs-number">0</span> Dispatch <span class="hljs-string">queue:</span> com.apple.main-thread

Exception <span class="hljs-keyword">Type</span>: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception <span class="hljs-string">Type:</span> EXC_BAD_ACCESS (SIGSEGV)
Exception <span class="hljs-string">Codes:</span> EXC_I386_GPFLT
</code></pre><p>Whenever I get an <code>EXC_BAD_ACCESS (SIGSEGV)</code> I feel like punching myself in the face, it&#39;s a memory issue, and I must have been really dumb to produce something like that in the ARC era.</p>
<p>But let&#39;s not waste time complaining about those things, risking to be kicked out of the dev program, and look for a solution.</p>
<h3 id="the-workaround">The workaround</h3>
Expand Down
12 changes: 6 additions & 6 deletions 2013/09/23/setup-a-dev-machine.html
Expand Up @@ -6,23 +6,23 @@ <h4 id="-homebrew-http-brew-sh-"><a href="http://brew.sh/">Homebrew</a></h4>
<p>Save time, and your sanity, use homebrew!</p>
<pre><code class="">ruby <span class="hljs-operator">-e</span> <span class="hljs-string">"<span class="hljs-variable">$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)</span>"</span>
</code></pre><p>homebrew saves stuff in <code>/usr/local/bin</code>, so make sure it comes <strong>before</strong> the default <code>/bin</code> in the <code>$PATH</code>.</p>
<pre><code class="">export <span class="hljs-constant">PATH</span>=<span class="hljs-regexp">/usr/local</span><span class="hljs-regexp">/bin/</span><span class="hljs-symbol">:</span><span class="hljs-variable">$PATH</span>
<pre><code class=""><span class="hljs-built_in">export</span> PATH=/usr/<span class="hljs-built_in">local</span>/bin/:<span class="hljs-variable">$PATH</span>
</code></pre><h4 id="-zsh-http-www-zsh-org-"><a href="http://www.zsh.org/">zsh</a></h4>
<pre><code class="">brew <span class="hljs-keyword">install</span> zsh
</code></pre><p>Zsh is cool, and with <a href="https://github.com/sorin-ionescu/prezto">prezto</a> we can make it super shiny.
<br/>
<em>Note:</em> the following instructions are from the prezto README, <a href="https://github.com/sorin-ionescu/prezto#installation">check it out</a> just to be sure they are up to date.</p>
<pre><code class="">zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git <span class="hljs-string">"<span class="hljs-variable">${ZDOTDIR:-$HOME}</span>/.zprezto"</span>
setopt EXTENDED_GLOB
git <span class="hljs-built_in">clone</span> --recursive https://github.com/sorin-ionescu/prezto.git <span class="hljs-string">"<span class="hljs-variable">${ZDOTDIR:-$HOME}</span>/.zprezto"</span>
<span class="hljs-built_in">setopt</span> EXTENDED_GLOB
<span class="hljs-keyword">for</span> rcfile <span class="hljs-keyword">in</span> <span class="hljs-string">"<span class="hljs-variable">${ZDOTDIR:-$HOME}</span>"</span>/.zprezto/runcoms/^README.md(.N); <span class="hljs-keyword">do</span>
ln <span class="hljs-operator">-s</span> <span class="hljs-string">"<span class="hljs-variable">$rcfile</span>"</span> <span class="hljs-string">"<span class="hljs-variable">${ZDOTDIR:-$HOME}</span>/.<span class="hljs-variable">${rcfile:t}</span>"</span>
<span class="hljs-keyword">done</span>
</code></pre><p>Finally, set zsh as the default shell</p>
<pre><code class="">chsh <span class="hljs-attribute">-s</span> /usr/<span class="hljs-built_in">local</span>/bin/zsh
<pre><code class="">chsh <span class="hljs-operator">-s</span> /usr/<span class="hljs-built_in">local</span>/bin/zsh
</code></pre><h4 id="-ruby-https-www-ruby-lang-org-en-of-course-via-rvm-https-rvm-io-"><a href="https://www.ruby-lang.org/en/">Ruby</a>, of course via <a href="https://rvm.io/">rvm</a></h4>
<pre><code class="">\curl -L <span class="hljs-keyword">https</span>://<span class="hljs-built_in">get</span>.rvm.io | bash -s stable
rvm install <span class="hljs-number">2.0</span><span class="hljs-number">.0</span>
<pre><code class="">\curl -L <span class="hljs-string">https:</span><span class="hljs-comment">//get.rvm.io | bash -s stable</span>
rvm install <span class="hljs-number">2.0</span>.0
</code></pre><h4 id="-python-http-www-python-org-a-proper-one"><a href="http://www.python.org/">Python</a>, a proper one</h4>
<pre><code class="">brew <span class="hljs-keyword">install</span> python
</code></pre><h4 id="-node-js-http-nodejs-org-"><a href="http://nodejs.org/">Node.js</a></h4>
Expand Down

0 comments on commit fdf85e6

Please sign in to comment.