Skip to content

Instantly share code, notes, and snippets.

View ptz0n's full-sized avatar

Erik Eng ptz0n

View GitHub Profile
@ptz0n
ptz0n / output
Last active December 19, 2015 22:59
ultrahook debugging
/Library/Ruby/Gems/1.8/gems/ultrahook-0.1.1/lib/ultrahook/client.rb:37:in `start': undefined method `home' for Dir:Class (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/ultrahook-0.1.1/bin/ultrahook:6
from /usr/bin/ultrahook:23:in `load'
from /usr/bin/ultrahook:23
@ptz0n
ptz0n / gist:5928784
Created July 4, 2013 15:55
MongoDB $in + sort() query
> db.mydocs.find({_id: {$in: [ObjectId("51be3ca24cc1682a13000003"), ObjectId("51be3c3b2799560d13000003")]}}).sort({'published': 1}).explain();
{
"cursor" : "BtreeCursor _id_ multi",
"nscanned" : 2,
"nscannedObjects" : 2,
"n" : 2,
"scanAndOrder" : true,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
@ptz0n
ptz0n / sadface
Last active December 13, 2015 22:49
~$ ping google.com
PING google.com (173.194.32.6): 56 data bytes
64 bytes from 173.194.32.6: icmp_seq=0 ttl=48 time=9.125 ms
64 bytes from 173.194.32.6: icmp_seq=1 ttl=48 time=8.574 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 8.574/8.849/9.125/0.276 ms
~$ ping www.glesys.com
PING www.glesys.com (79.99.6.7): 56 data bytes
@ptz0n
ptz0n / .bash_profile
Last active February 22, 2017 08:44
Bashing that profile
alias ls="ls -lFa"
alias checkout="git checkout"
alias co="git commit -v"
alias gl="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gs="git status -s"
alias pull="git pull"
alias push="git push"
alias up="vagrant up"
alias myip="curl ifconfig.me"
@ptz0n
ptz0n / gist:4276448
Created December 13, 2012 13:41
Regexp matching UserAgent for Mobile Safari on iPhone or iPod touch devices running iOS 6, exept in application browser (web view).
iPhone OS 6(?:(?:.|\n|\r)*)Safari
Mobile Safari
Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X)
AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523
Safari/8536.25
@ptz0n
ptz0n / .sublime-keymap
Last active October 12, 2015 07:37
Sublime Text 2 Config
[
{
"keys": ["ctrl+w"],
"command": "toggle_setting",
"args":
{
"setting": "word_wrap"
}
},
{
@ptz0n
ptz0n / gist:3298107
Created August 8, 2012 20:05
Pingdom last down check
<?php
$apiKey = 'foo123bar';
$username = 'you@domain.com';
$password = 'yourpassword';
$check = 123;
// Init cURL
$curl = curl_init();
// Set target URL
curl_setopt($curl, CURLOPT_URL, 'https://api.pingdom.com/api/2.0/checks/'.$check);
@ptz0n
ptz0n / widget.js
Created July 25, 2012 06:20
Tågtider JavaScript Widget
// See http://alexmarandon.com/articles/web_widget_jquery/
(function() {
// Localize jQuery variable
var jQuery;
var remoteJquery = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js';
var localJquery = 'static/js/jquery-1.6.4.min.js';
/**
@ptz0n
ptz0n / _respond.scss
Created July 22, 2012 10:11
Sass respond to mixin
@mixin respond-to($media) {
@if $media == landscape {
@media screen and (min-width: 321px) { @content; }
}
@else if $media == tablet {
@media only screen and (min-width: 768px) { @content; }
}
@else if $media == desktop {
@media only screen and (min-width: 992px) { @content; }
}
@ptz0n
ptz0n / gist:1646171
Created January 20, 2012 08:43
Recursive merge of arrays with integer keys
<?php
/**
* Merge two dimensional arrays my way
*
* Will merge keys even if they are of type int
*
* @param array $array1 Initial array to merge.
* @param array ... Variable list of arrays to recursively merge.
*