This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let app = Application('Safari'); | |
app.includeStandardAdditions = true; | |
let finalText = ""; | |
for (var i = 0; i < app.windows.length; i += 1) { | |
for (var j = 0; j < app.windows[i].tabs.length; j += 1) { | |
finalText += "[" + app.windows[i].tabs[j].name() + "]: " + app.windows[i].tabs[j].url() + "\n"; | |
} | |
finalText += "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Copyright 2012-2013 Ryan. All rights reserved. | |
* https://github.com/rsully | |
* https://gist.github.com/rsully/4162064 | |
* You may use this code provided this message and the above copyright are kept in place. | |
**/ | |
class DB extends PDO | |
{ | |
protected $prepared = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Generator { | |
protected $namespaces = []; | |
protected $outputDirectoriesPSR4 = []; | |
protected $aliasMapTypes = []; | |
protected $inputFiles = []; | |
/* | |
* Methods to setup the data we need to generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_bourne | |
set --local line $argv[1] # the line X=Y | |
set --local exp $argv[2] # 1/0: export the variable | |
set --local key (echo $line | perl -pe 's/^([A-Za-z0-9_]+)=(.*)/$1/g') | |
set --local dataraw (echo $line | perl -pe 's/^([A-Za-z0-9_]+)=(.*)/$2/g') | |
set --local data $dataraw | |
# echo "in set_bourne for $key with $exp" | |
# echo "old value: $$key" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = '/Volumes/drive/path.dat'; | |
$write_to = '/tmp/output.dat'; | |
$fh_out = fopen($write_to, 'w+'); | |
clearstatcache(); | |
while (!file_exists($path)) { | |
sleep(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::before(function($request) | |
{ | |
// determine the subdomain of the current request | |
$server = explode('.', Request::server('HTTP_HOST')); | |
$sansSubdomain = implode('.', array_slice($server, 1)); | |
// there are 3 parts to the domain (i.e. user.domain.com) | |
if (count($server) == 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Implementation | |
function iterate($original) | |
{ | |
$board = $original; | |
for ($x = 0; $x < count($board); $x++) { | |
$row = $board[$x]; | |
for ($y = 0; $y < count($row); $y++) { | |
$cell = $row[$y]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/** | |
* Help from: | |
* http://stackoverflow.com/questions/1821811/how-to-read-write-from-to-file | |
* https://groups.google.com/forum/#!topic/golang-nuts/1mc64pj_S50 | |
* http://pastebin.com/DgurHbpe | |
**/ | |
import ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
// Requirements: | |
// sudo apt-get install php5-cli php-pear libyaml-dev | |
// sudo pecl install yaml | |
$file = $_SERVER['HOME'] . '/.config/sflphone/sflphoned.yml'; | |
$acct_id = get_account_id($file); | |
$call_to = preg_replace('/[^0-9]/', '', $argv[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcl2pdf() { | |
input=$1 | |
output=${2-$input.pdf} | |
pcl6 -o $output -sDEVICE=pdfwrite $input | |
} |
NewerOlder