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/perl | |
use utf8; | |
use Encode; | |
binmode STDOUT, ":encoding(UTF-8)"; | |
$string = "カタカナ, 片仮名"; | |
print "Internal Format: " . $string . "\n"; | |
$octets = encode("utf8", $string); | |
print "Encoded as UTF-8: " . $octets . "\n"; | |
print "Encoded as UTF-8(Unpacked as Hex): " . unpack("H*",$octets) . "\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
%% -*- coding: utf-8 -*- | |
-module(useless). | |
-export([useless/0, return_a_number/0, do_the_things_you_do/0]). | |
useless() -> | |
"I'm useless!÷". | |
return_a_number() -> | |
X = 4 + 4, | |
Y = X + 7, |
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 | |
$a = array(1, 2, 3, 4, 5); | |
$f = function($a) { return (($a * 2));}; | |
$b = array_values(array_map($f, array_filter($a, function($a) {return ($a > 2);}))); | |
var_dump($b); |
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
sub oneLineArray | |
{ | |
my $a = shift @_; | |
my @array = @$a; | |
print "("; | |
foreach(@array){ | |
print " " . $_; | |
if($_ ne $array[$#array]){ | |
print ","; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> | |
<script src="http://documentcloud.github.io/underscore/underscore-min.js"></script> | |
<script src="http://documentcloud.github.io/backbone/backbone-min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> |
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
#include "linkedlist.h" | |
int_node linked_list(int data, int_node *link) | |
{ | |
int_node l = {data, link}; | |
return l; | |
} |
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
execute pathogen#infect() | |
set background:dark | |
syntax on | |
filetype plugin indent on | |
set nowrap | |
set shiftwidth=4 | |
set ts=4 | |
set expandtab | |
set encoding=utf-8 |
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
/* | |
LiquidCrystal Library - Hello World | |
Demonstrates the use a 16x2 LCD display. The LiquidCrystal | |
library works with all LCD displays that are compatible with the | |
Hitachi HD44780 driver. There are many of them out there, and you | |
can usually tell them by the 16-pin interface. | |
This sketch prints "Hello World!" to the LCD | |
and shows the time. |
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
#!/bin/bash | |
# SSH with host name and IP address in background (only in iTerm.app) | |
# First, check to see if we have the correct terminal! | |
if [ "$(tty)" == 'not a tty' ] || [ "$TERM_PROGRAM" != "iTerm.app" ] ; then | |
/usr/bin/ssh "$@" | |
exit $? | |
fi |
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 | |
# Inspired by https://stackoverflow.com/a/49007601 | |
function stdout($arg) { | |
if (is_object($arg) || is_array($arg) || is_resource($arg)) { | |
$output = print_r($arg, true); | |
} else { | |
$output = (string) $arg; | |
} | |
file_put_contents('php://stdout', $output . \PHP_EOL); |