-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
430 lines (332 loc) · 20.6 KB
/
index.html
File metadata and controls
430 lines (332 loc) · 20.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Blog | Basetta.Bz</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="http://www.gravatar.com/avatar/ca478a8e7a11eb94f329f1bef1984f3f.png
?s=16">
<link rel="stylesheet" href="/css/reset.css">
<link rel="stylesheet" href="/css/mobile.css">
<link rel="stylesheet" href="/css/desktop.css" media="(min-width:40em)">
<link rel="stylesheet" href="/css/pygments.css">
<link rel="stylesheet" href="/css/font.css">
<script type="text/javascript" charset="utf-8" src="/js/matchmedia.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/picturefill.js"></script>
</head>
<body>
<div class="wrapper">
<header>
<div class="container">
<div class="profile">
<div class="social">
<a href="http://twitter.com/basettabz">
<div data-picture data-alt="Twitter">
<div data-src="/img/twitter16.png"></div>
<div data-src="/img/twitter32.png" data-media="(-webkit-min-device-pixel-ratio: 2)"></div>
<noscript><img src="/img/twitter16.png" alt="Twitter"></noscript>
</div>
</a>
<a href="http://github.com/basetta">
<div data-picture data-alt="Github">
<div data-src="/img/octocat16.png"></div>
<div data-src="/img/octocat32.png" data-media="(-webkit-min-device-pixel-ratio: 2)"></div>
<noscript><img src="/img/octocat16.png" alt="Github"></noscript>
</div>
</a>
<a href="https://alpha.app.net/basetta">
<div data-picture data-alt="App.net">
<div data-src="/img/alpha16.png"></div>
<div data-src="/img/alpha32.png" data-media="(-webkit-min-device-pixel-ratio: 2)"></div>
<noscript><img src="/img/octocat16.png" alt="Github"></noscript>
</div>
</a>
</div>
<img src="http://www.gravatar.com/avatar/ca478a8e7a11eb94f329f1bef1984f3f.png
?s=54" alt="avatar" class="avatar" />
</div>
<h5 class="logo"><a href="http://basetta.bz">Basetta.Bz</a></h5>
<nav>
<ul>
<li><a href="http://basetta.bz" class="active">Blog</a></li>
<li><a href="http://basetta.bz/about">About</a></li>
</ul>
</nav>
<div class="nav-slider">
<div class="nav-selection blog"></div>
</div>
</div>
</header>
<section id="main">
<article class="container">
<article class="post">
<div class="post-header">
<p class="date">Aug 10, 2013
<span class='comment_number'><a href="/2013/08/10/create-omnifocus-project-with-applescript#disqus_thread" data-disqus-identifier="2013-08-10-create-omnifocus-project-with-applescript.md"></a>
</span>
</p>
<h1><a href="/2013/08/10/create-omnifocus-project-with-applescript">Create OmniFocus Project with AppleScript</a></h1>
</div>
<div class="post-body">
<p>At work one of my duty is to take care of purchase orders for my team mates. The workflow involve always the same three steps.</p>
<p>Being an Omnifocus user, I wrote a small AppleScript that takes as input a purchase description and as output creates
a main task with three sub tasks in Omnifocus directly.</p>
<div class="highlight"><pre><code class="applescript"><span class="c">-- Entry point when run</span>
<span class="k">on</span> <span class="nb">run</span>
<span class="nb">display dialog</span> <span class="s2">"Enter purchase order description:"</span> <span class="nv">default</span> <span class="nv">answer</span> <span class="s2">"Purchase"</span>
<span class="nv">createOmniFocusTask</span><span class="p">(</span><span class="nb">the</span> <span class="no">result</span>'s <span class="na">text returned</span><span class="p">)</span>
<span class="k">end</span> <span class="nb">run</span>
<span class="c">-- Create tasks in Omnifocus</span>
<span class="k">on</span> <span class="nv">createOmniFocusTask</span><span class="p">(</span><span class="nv">eventName</span><span class="p">)</span>
<span class="k">tell</span> <span class="nb">application</span> <span class="s2">"OmniFocus"</span>
<span class="k">tell</span> <span class="nv">default</span> <span class="na">document</span>
<span class="c">-- Grab the context</span>
<span class="k">set</span> <span class="nv">purchaseContext</span> <span class="k">to</span> <span class="nb">first</span> <span class="na">context</span> <span class="nb">whose</span> <span class="na">name</span> <span class="ow">is</span> <span class="s2">"Emarsys"</span>
<span class="c">-- Create the task inside a project</span>
<span class="k">set</span> <span class="nv">fld</span> <span class="k">to</span> <span class="nb">first</span> <span class="nv">folder</span> <span class="nb">whose</span> <span class="na">name</span> <span class="ow">is</span> <span class="s2">"Emarsys"</span>
<span class="k">tell</span> <span class="nv">fld</span>
<span class="k">set</span> <span class="nv">proj</span> <span class="k">to</span> <span class="nb">first</span> <span class="nv">project</span> <span class="nb">whose</span> <span class="na">name</span> <span class="ow">is</span> <span class="s2">"Single Actions"</span>
<span class="k">tell</span> <span class="nv">proj</span>
<span class="c">-- Create parent task and its subtasks.</span>
<span class="k">set</span> <span class="nv">parentTask</span> <span class="k">to</span> <span class="nb">make</span> <span class="nb">new</span> <span class="nv">task</span> <span class="nv">with</span> <span class="na">properties</span> <span class="p">{</span><span class="na">name</span><span class="p">:</span><span class="nv">eventName</span><span class="p">,</span> <span class="nv">sequential</span><span class="p">:</span><span class="no">true</span><span class="p">}</span>
<span class="k">tell</span> <span class="nv">parentTask</span>
<span class="nb">make</span> <span class="nb">new</span> <span class="nv">task</span> <span class="nv">with</span> <span class="na">properties</span> <span class="p">{</span><span class="na">name</span><span class="p">:</span><span class="s2">"Print Formular for "</span> <span class="o">&</span> <span class="nv">eventName</span><span class="p">,</span> <span class="na">context</span><span class="p">:</span><span class="nv">purchaseContext</span><span class="p">}</span>
<span class="nb">make</span> <span class="nb">new</span> <span class="nv">task</span> <span class="nv">with</span> <span class="na">properties</span> <span class="p">{</span><span class="na">name</span><span class="p">:</span><span class="s2">"Get the Sign for "</span> <span class="o">&</span> <span class="nv">eventName</span><span class="p">,</span> <span class="na">context</span><span class="p">:</span><span class="nv">purchaseContext</span><span class="p">}</span>
<span class="nb">make</span> <span class="nb">new</span> <span class="nv">task</span> <span class="nv">with</span> <span class="na">properties</span> <span class="p">{</span><span class="na">name</span><span class="p">:</span><span class="s2">"Order for "</span> <span class="o">&</span> <span class="nv">eventName</span><span class="p">,</span> <span class="na">context</span><span class="p">:</span><span class="nv">purchaseContext</span><span class="p">}</span>
<span class="k">end</span> <span class="k">tell</span>
<span class="k">end</span> <span class="k">tell</span>
<span class="k">end</span> <span class="k">tell</span>
<span class="k">end</span> <span class="k">tell</span>
<span class="k">end</span> <span class="k">tell</span>
<span class="k">end</span> <span class="nv">createOmniFocusTask</span>
</code></pre></div>
<p>Copy and paste that into a new script in AppleScript Editor (or download a copy <a href="https://github.com/basetta/dotfiles/blob/master/applescripts/e3purchase_omnifocus.applescript">here</a>) and try it out.</p>
<p>Of course, you have to adapt a little bit if you do not have an Emarsys context.</p>
</div>
</article>
<article class="post">
<div class="post-header">
<p class="date">Jan 28, 2013
<span class='comment_number'><a href="/2013/01/28/protect-your-private-data-using-gitconfig-include-directive#disqus_thread" data-disqus-identifier="2013-01-28-protect-your-private-data-using-gitconfig-include-directive.markdown"></a>
</span>
</p>
<h1><a href="/2013/01/28/protect-your-private-data-using-gitconfig-include-directive">Protect Your Private Data Using Gitconfig Include Directive</a></h1>
</div>
<div class="post-body">
<p>I am using a <a href="https://github.com/basetta/dotfiles">dotfiles</a> git repository in order to keep my machine preferences in sync.</p>
<p>This is working pretty well, until you realise that are some config entries that are clashing with each other.</p>
<p>One of those cases, is the common situation of having two github accounts -- one for work and one for private purposes. In this case we would like to share the common git configuration but not the committer's author name and email address held in the .gitconfig.</p>
<p>Recently, git added a new feature, the include directive for config files ( since 1.7.10 ) that can solve the problem.
With the include feature you can split your gitconfig across multiple files, so you can have the common git configuration in one file, and private information in another.</p>
<p>Let's have a look at an example :</p>
<ul>
<li>Add the include directive to your .gitconfig ( this is the file in your git dotfiles repository )</li>
</ul>
<div class="highlight"><pre><code class="bash"> <span class="o">[</span>include<span class="o">]</span>
<span class="nv">path</span> <span class="o">=</span> ~/.gitconfig_user
</code></pre></div>
<ul>
<li>Add to ~/.gitconfig_user your private data</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="o">[</span>user<span class="o">]</span>
<span class="nv">name</span> <span class="o">=</span> Silvio Berlusconi
<span class="nv">email</span> <span class="o">=</span> silvio.berlusconi@bungabunga.it
</code></pre></div>
<ul>
<li>Test if the config is working properly</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git config user.name
Silvio Berlusconi
<span class="nv">$ </span>git config user.email
silvio.berlusconi@bungabunga.it
</code></pre></div>
</div>
</article>
<article class="post">
<div class="post-header">
<p class="date">May 12, 2012
<span class='comment_number'><a href="/2012/05/12/extract-a-directory-from-a-git-branch-slash-repository-preserving-the-history#disqus_thread" data-disqus-identifier="2012-05-12-extract-a-directory-from-a-git-branch-slash-repository-preserving-the-history.markdown"></a>
</span>
</p>
<h1><a href="/2012/05/12/extract-a-directory-from-a-git-branch-slash-repository-preserving-the-history">Extract a Directory From a Git Branch/Repository Preserving The History</a></h1>
</div>
<div class="post-body">
<p>At work we wanted to extract from a branch a subdirectory containing a specific feature that had to be used from everyone in the team.</p>
<p>Just for sake of example, let's define the terms of our problem.
Our repository (MAIN) structure looks like:</p>
<div class="highlight"><pre><code class="bash">MAIN/
Library/
libA/
libB/
libC/
</code></pre></div>
<p>Our goal is to extract the libA contained in the branch FTR-B in its own branch called FTR-A.</p>
<p>If you are not interested in preserving the history the task is quite easy. <strong>Git checkout</strong> is our friend in this case.</p>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git checkout master
<span class="nv">$ </span>git checkout -b FTR-A
<span class="nv">$ </span>git checkout FTR-B Library/libA
<span class="nv">$ </span>git commit -a -m <span class="s2">"Extract libA"</span>
<span class="nv">$ </span>git push
</code></pre></div>
<p>More complicated is the case in which preserving the history is a matter of importance.
For God's sake <strong>git</strong> has a powerful command <strong>git filter-branch</strong>.
The following are my notes and observations, for pleasing my poor memory.</p>
<ul>
<li>Clone the local repository into a temporary repository DIRTY.</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git clone ~/MAIN/ ~/DIRTY/
<span class="nv">$ </span><span class="nb">cd </span>DIRTY
<span class="nv">$ </span>git checkout FTR-B
</code></pre></div>
<ul>
<li>Remove everything except the desired subdirectory ( libA ).</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git filter-branch --prune-empty --tree-filter <span class="s1">'rm -rf Library/libB Library/libC'</span>
</code></pre></div>
<p>Basically, <strong>Git filter-branch</strong> executes a command on each commit in a specific branch. Instead of the option <strong>tree-filter</strong> you could have used <strong>subdirectory-filter</strong> that removes everything except the desired directory moving it up to the root project. I will explain it better in another post.</p>
<ul>
<li>Clean all the cruft</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git gc --aggressive
</code></pre></div>
<ul>
<li>Merge the new feature in its own branch FTR-A.</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span><span class="nb">cd</span> ~/MAIN
<span class="nv">$ </span>git remote add dirty ~/DIRTY
<span class="nv">$ </span>git fetch dirty
<span class="nv">$ </span>git branch dirty remotes/tools/FTR-B
<span class="nv">$ </span>git checkout master
<span class="nv">$ </span>git checkout -b FTR-A
<span class="nv">$ </span>git merge dirty
<span class="nv">$ </span>git remote rm dirty
</code></pre></div>
<ul>
<li>Create a pull request</li>
</ul>
</div>
</article>
<article class="post">
<div class="post-header">
<p class="date">Apr 18, 2012
<span class='comment_number'><a href="/2012/04/18/how-to-fetch-upstream-changes-in-git-easily#disqus_thread" data-disqus-identifier="2012-04-18-how-to-fetch-upstream-changes-in-git-easily.markdown"></a>
</span>
</p>
<h1><a href="/2012/04/18/how-to-fetch-upstream-changes-in-git-easily">How to fetch upstream changes in git easily</a></h1>
</div>
<div class="post-body">
<p>It is quite common to update your git fork repository with the upstream changes.</p>
<p>Here it is the workflow I use to keep synchronize my branch with <a href="http://www.google.com">Octopress</a>.</p>
<ul>
<li> First of all, we should configure the remotes.</li>
</ul>
<div class="highlight"><pre><code class="bash"><span class="nv">$ </span>git remote add upstream git://github.com/imathis/octopress.git
</code></pre></div>
<ul>
<li> Check the remotes</li>
</ul>
<div class="highlight"><pre><code class="bash"> <span class="nv">$ </span>git remote
</code></pre></div>
<ul>
<li> Merge/Rebase the changes</li>
</ul>
<div class="highlight"><pre><code class="bash"> <span class="nv">$ </span>git fetch origin -v
<span class="nv">$ </span>git fetch upstream -v
<span class="nv">$ </span>git merge upstream/master
</code></pre></div>
<p>If you prefere you can create an alias in your <em>.gitconfig</em>.</p>
<div class="highlight"><pre><code class="bash"><span class="o">[</span><span class="nb">alias</span><span class="o">]</span>
<span class="nv">pull_upstream</span> <span class="o">=</span> !<span class="s2">"git fetch origin -v; git fetch upstream -v; git merge upstream/master"</span>
</code></pre></div>
<p>Now <em>git pull_upstream</em> will fetch the changes of both remotes, and the merge in the upstream changes.</p>
</div>
</article>
<article class="post">
<div class="post-header">
<p class="date">Feb 04, 2012
<span class='comment_number'><a href="/2012/02/04/back-online#disqus_thread" data-disqus-identifier="2012-02-04-back-online.markdown"></a>
</span>
</p>
<h1><a href="/2012/02/04/back-online">Back Online</a></h1>
</div>
<div class="post-body">
<p>It has been nearly four years since I last posted. Quite a lot.
Anyhow, now I am back online thanks to <a href="http://octopress.org/">Octopress</a> and Github pages.</p>
<p>I'll have more to do:</p>
<ul>
<li>write a catch up post</li>
<li>importing the old posts parked <a href="http://ricettebimby.pupazzo.org">here</a> after my previous Django blog
abandoned me.</li>
<li>personalized the Octopress default template.</li>
</ul>
</div>
</article>
<!-- Pagination links -->
<div class="pagination">
<a href="/page2" class="next button"><span>Older</span></a>
</div>
</article>
</section>
<footer>
<nav class="container">
<ul>
<li>© Patrick Martini 2013</li>
<li>Design by Tyler Benziger</li>
</ul>
</nav>
</footer>
</body>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3020776-9']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" charset="utf-8">
document.onreadystatechange = function() {
if ( document.readyState == 'complete' ) {
var active = document.querySelector( 'header a.active' ).innerHTML.toLowerCase(),
links = document.querySelectorAll( 'header nav li a'),
selection = document.querySelector( 'header .nav-selection' ),
i, link;
for ( i = 0; i < links.length; i++ ) {
link = links[ i ];
console.log(link);
link.addEventListener( 'mouseover', function() {
selection.className = 'nav-selection';
selection.className = 'nav-selection ' + this.innerHTML.toLowerCase();
});
link.addEventListener( 'mouseout', function() {
selection.className = 'nav-selection ' + active;
});
}
}
};
</script>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'basettabz'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'basettabz'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</html>