Skip to content

Instantly share code, notes, and snippets.

View zmughal's full-sized avatar
🌿
fiddling with attribute grammars.

Zaki Mughal [sivoais] zmughal

🌿
fiddling with attribute grammars.
View GitHub Profile
#!/usr/bin/env perl
use 5.016;
use DateTime;
my @phrase = qw/another Perl Just hacker/[split '', DateTime->now->year()]; # only works this year!
say join ' ', @phrase;
#!/usr/bin/env perl6
use Test;
my %arabic-to-roman = <
1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL
10 X 9 IX 5 V 4 IV 1 I
>;
my @arabic = %arabic-to-roman.keys.sort({ $^b <=> $^a });
#!/usr/bin/env perl6
use Test;
class Promise {
enum State <PENDING FULFILLED REJECTED>;
has State $.state = PENDING;
has @.fulfill-queue;
@zmughal
zmughal / bands-from-Leeds.rq
Last active December 19, 2015 02:59
SPARQL example
# http://dbpedia.org/sparql
select ?band
where {
?band rdf:type <http://schema.org/MusicGroup>.
?band dbo:hometown dbr:Leeds.
}
LIMIT 100
# <http://bit.ly/dbpedia-bands-from-leeds-20151106>
TodoMVC.module 'TodoApp', (App, TodoMVC, Backbone, Marionette, $, _) ->
log arguments
class App.TodoForm extends Marionette.ItemView
events:
'keypress #new-todo' : 'createOnEnter'
'click .mark-all-done' : 'toggleAllClicked'
triggers:
'click .todo-clear a' : 'clear:completed'
Retrieves MetaCPAN favourites and gets the associated GitHub repositories.
Checks if repository is starred and prompts to star the GitHub repository if
not already starred.
#!/bin/sh
if ! which xclip xdotool >/dev/null; then
echo "$0: requires xclip, xdotool"
exit 1
fi
xclip -i -selection primary
TEMP=`xclip -o -selection primary` # store it so it does get lost when clicking
MATLAB_WIN=`xdotool search 'MATLAB R' 2>/dev/null | head -1`
if [ -z "$MATLAB_WIN" ]; then
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do.
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk:
git svn clone -T trunk http://example.com/PROJECT
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T:
git svn clone -T branches/somefeature http://example.com/PROJECT
find . -type d -name .svn -exec git rm -r {} \; git commit -m 'removed .svn directories'