Skip to content

Instantly share code, notes, and snippets.

@iamleeg
iamleeg / printplist.pl
Created May 12, 2012 13:39
Using the PerlObjCBridge to display a plist file
#!/usr/bin/perl -w
use strict;
use Foundation;
my $plist = NSDictionary->dictionaryWithContentsOfFile_("/Applications/TextEdit.app/Contents/Info.plist");
print $plist->description()->UTF8String();
@jberger
jberger / upload.pl
Last active May 4, 2020 09:09
mojolicious file uploads via websocket
#!/usr/bin/env perl
use Mojolicious::Lite;
use Mojo::JSON 'j';
use Mojo::Asset::Memory;
use File::Spec;
helper send_ready_signal => sub {
my $self = shift;
my $payload = { ready => \1 };
@jberger
jberger / websocket.pl
Created July 4, 2013 18:54
Minimal Mojolicious websocket example
#!/usr/bin/env perl
use Mojolicious::Lite;
any '/' => 'index';
websocket '/time' => sub {
my $c = shift;
my $t = Mojo::IOLoop->recurring( 1 => sub {
$c->send( time );
@justvitalius
justvitalius / nonbounce.js
Last active December 26, 2015 11:19
turn off mobile webkit bounce effect on iPad & iphone
(function($){
"use strict";
var startY;
var defaults = {
"$these": [],
"touchstartInit": false,
"touchmoveInit": false
};
@Starefossen
Starefossen / remoteDataTableView.swift
Last active January 16, 2023 09:50
Remote JSON Data to tableView in iOS 8.0 (Swift)
import UIKit
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
class RemoteAPI {
func getData(completionHandler: ((NSArray!, NSError!) -> Void)!) -> Void {
let url: NSURL = NSURL(string: "http://itunes.apple.com/search?term=Turistforeningen&media=software")
let ses = NSURLSession.sharedSession()
@z448
z448 / perl-locale-fix.sh
Last active December 19, 2015 17:38
random.pl.sh
## try to add into .bash_profile if you see folowing locale errors
##################################################################
## perl: warning: Setting locale failed.
## perl: warning: Please check that your locale settings:
## LANGUAGE = (unset),
## LC_ALL = (unset),
## LANG = "en_US.UTF-8"
## are supported and installed on your system.
## perl: warning: Falling back to the standard locale ("C").
@z448
z448 / check_lib.pl
Last active May 6, 2019 15:45
perls
#!/usr/bin/env perl
# cklib
# checks if lib is in $path /$ARGV[0]/
use 5.010;
use FFI::CheckLib;
check_lib_or_exit( lib => 'jpeg', symbol => 'jinit_memory_mgr' );
check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] );
# or prompt for path to library and then: print "where to find jpeg library: ";
my $path = <STDIN>;
@z448
z448 / vim-tips.txt
Created February 18, 2016 02:29
shortcuts
source: https://www.instapaper.com/text?u=http%3A%2F%2Fzzapper.co.uk%2Fvimtips.html
__BEGIN__
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down