Skip to content

Instantly share code, notes, and snippets.

View veb's full-sized avatar
👋

Mike Mackenzie veb

👋
View GitHub Profile
@veb
veb / rightDiv.php
Created September 10, 2015 16:52
articles-2
<?php
// $content is the content you scraped (via curl for example)
$dom = new DOMDocument();
@$dom->loadHTML($content)
$xpath = new DOMXPath($dom);
$rightDivText = $xpath->query("//html/body/div[@id='mainDiv']/div[@id='rightDiv']/p/text()");
@veb
veb / index.html
Created September 10, 2015 16:51
articles-1
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="mainDiv">
<div id="leftDiv">
<p class="bodyText">This is left</p>
<img src="images/test.jpg" />
</div>
@mixin invert($amt: 100%) {
-o-filter: invert($amt);
-ms-filter: invert($amt);
-moz-filter: invert($amt);
-webkit-filter: invert($amt);
@-moz-document url-prefix() {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'invert\'><feColorMatrix in='SourceGraphic' type='matrix' values='-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0'/></filter></svg>#invert");
background-color: #000;
}
@veb
veb / gist:2721b519f689033a20ef
Created July 9, 2015 11:55
Highlight Git repos in Finder (for OSX)
set theSearchPath to "/Users/<username>"
set theResults to do shell script "find " & quoted form of theSearchPath & " -name .git ! -perm -g+r,u+r,o+r -prune"
repeat with i from 1 to (count paragraphs of theResults)
set theResult to paragraph i of theResults
set theParentPath to text 1 through ((length of theResult) - 5) of theResult
set theParentAlias to POSIX file (theParentPath) as alias
tell application "Finder"
set label index of theParentAlias to 6
-- Set the last value of the previous line corresponding to label color desired
@veb
veb / fizzbuzz2.php
Created June 29, 2015 03:38
fizzbuzz2.php
<?php
/*
* Task:
* Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz".
* For numbers which are multiples of both three and five print "FizzBuzz".
*
* Instructions:
* This file (fizzbuzz.php) can be uploaded to a webserver that's running PHP4+ and executed with "php fizzbuzz.php" from the command line.
* Alternatively, this file can be accessed directly (if webserver permissions allow) via your browser.
@veb
veb / fizzbuzz.php
Created June 29, 2015 03:32
fizzbuzz.php
<?php
/*
* Task:
* Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz".
* For numbers which are multiples of both three and five print "FizzBuzz".
*
* Instructions:
* This file (fizzbuzz.php) can be uploaded to a webserver that's running PHP4+ and executed with "php fizzbuzz.php" from the command line.
* Alternatively, this file can be accessed directly (if webserver permissions allow) via your browser.
@veb
veb / aaaa.php
Created June 29, 2015 00:38
fizzbuzzzzz
<?php
for ($i = 1; $i <= 100; $i++)
{
$cond['Fizz'] = 3;
$cond['Buzz'] = 5;
$x = $i;
foreach($cond as $k => $v) {

Keybase proof

I hereby claim:

  • I am veb on github.
  • I am veb (https://keybase.io/veb) on keybase.
  • I have a public key whose fingerprint is 79B1 156C 1BD1 36E9 879A F6DD 58D6 049E 3078 DC1E

To claim this, I am signing this object:

@veb
veb / gist:2d18d020bc04c6de5964
Created January 15, 2015 08:24
Get both the version of Django and Python
python -c "import django; print(django.get_version())"
@mixin invert($amt: 100%) {
-o-filter: invert($amt);
-ms-filter: invert($amt);
-moz-filter: invert($amt);
-webkit-filter: invert($amt);
@-moz-document url-prefix() {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'invert\'><feColorMatrix in='SourceGraphic' type='matrix' values='-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0'/></filter></svg>#invert");
background-color: #000;
}