Skip to content

Instantly share code, notes, and snippets.

View nobuf's full-sized avatar
💭
🤔

Nobu Funaki nobuf

💭
🤔
View GitHub Profile
@nobuf
nobuf / cli-ses_send_email.php
Created February 20, 2011 22:28
Sending email with Amazon SES in sandbox
<?php
require_once './sdk.class.php'; // http://aws.amazon.com/sdkforphp/
define('VERIFIED_FROM_EMAIL_ADDRESS', 'from@example.com');
define('VERIFIED_TO_EMAIL_ADDRESS', 'to@example.com');
$ses = new AmazonSES(AWS_KEY, AWS_SECRET_KEY);
var_dump($ses->send_email(VERIFIED_FROM_EMAIL_ADDRESS,
array('ToAddresses' => VERIFIED_TO_EMAIL_ADDRESS),
array(
@nobuf
nobuf / sample_zend_service_twitter.php
Created February 22, 2011 05:17
Accessing Twitter API with Zend_Service_Twitter + Zend_Oauth_Token_Access
<?php
require_once 'Zend/Service/Twitter.php';
$me = 'zuzara';
$accessToken = new Zend_Oauth_Token_Access;
$accessToken->setToken('***')
->setTokenSecret('***'); // grab them at https://dev.twitter.com/apps/***/my_token
$twitter = new Zend_Service_Twitter(array(
@nobuf
nobuf / tac.php
Created April 17, 2011 18:09
tac in php
#!/usr/local/bin/php
<?php
$lines = array_reverse(file($argv[1]));
array_walk($lines, function($value, $key){
echo $value;
});
@nobuf
nobuf / gist:1079154
Created July 12, 2011 22:35
Return bolded string for CLI
function bold($str)
{
return chr(27) . "[1m" . $str . chr(27) . "[0m";
}
@nobuf
nobuf / gist:1100838
Created July 23, 2011 01:46
.live and .bind, the order
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('div').one('click', function(){
console.log('div is clicked.');
});
//$('span').bind('click', function(){
$('span').live('click', function(){
@nobuf
nobuf / gist:1260933
Created October 4, 2011 04:52
Update console vim on Mac
wget https://raw.github.com/niw/homebrew/master/Library/Formula/vim.rb
easy_install mercurial
brew install /usr/local/Library/Formula/vim.rb
@nobuf
nobuf / gist:3419910
Created August 21, 2012 22:15
Supporting placeholder on IE9 with AngularJS + jQuery
angular.module('test', [])
.directive('placeholder', function($timeout){
if (!$.browser.msie || $.browser.version >= 10) {
return {};
}
return {
link: function(scope, elm, attrs){
if (attrs.type === 'password') {
return;
}
@nobuf
nobuf / gist:6597ca902dab97a9db5b
Last active August 29, 2015 14:02
Generate US States TopoJSON from the 2013 Census shape file
# Kind of fork from https://github.com/jgoodall/us-maps
#
# Access http://www.census.gov/cgi-bin/geo/shapefiles2013/main
# Choose 'States (and equivalent)' and 'Submit'
mkdir tl_2013_us_state
cd tl_2013_us_state
mkdir topojson geojson
unzip ../tl_2013_us_state.zip
ogr2ogr -f "GeoJSON" geojson/state.json tl_2013_us_state.shp tl_2013_us_state
topojson --id-property STUSPS --out topojson/state.json geojson/state.json
@nobuf
nobuf / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nobuf
nobuf / private.xml
Last active August 29, 2015 14:23
private.xml for Karabiner
<?xml version="1.0"?>
<root>
<item>
<name>Switch Input Method to Expose key</name>
<appendix>Ctrl-3 to the Expose key (F3)</appendix>
<identifier>remap.input_method_to_fkeys_f3</identifier>
<autogen>__KeyToKey__ KeyCode::EXPOSE_ALL, KeyCode::KEY_3, ModifierFlag::CONTROL_L</autogen>
</item>
</root>