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
require "oauth2" | |
require_relative "token" | |
module Api | |
class Client | |
def initialize(client_id:, client_secret:, endpoint:) | |
@client_id = client_id | |
@client_secret = client_secret | |
@endpoint = endpoint | |
end |
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> | |
<style> | |
.vertically_align { | |
width: 256px; | |
height: 256px; | |
overflow: hidden; | |
} |
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/env ruby | |
require "rubyXL" | |
require "pry" | |
require "json" | |
# define from input | |
@key_col = 0 | |
@translation_col = 2 | |
file = PATH_TO_FILE |
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
// Setup | |
var array = []; | |
for(var i = 0; i < 1000; ++i) { array.push(i); } | |
var totals = {}; | |
var log = function (id, time) { | |
totals[id] = totals[id] ? totals[id] : []; | |
totals[id].push(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
require 'logger' | |
$logger = Logger.new(STDOUT) | |
require 'active_support/cache' | |
$cache = ActiveSupport::Cache.lookup_store(:memory_store) | |
$cache.logger = $logger | |
$cache.clear | |
class EtagMiddleware |
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
penup | |
lt 180 | |
fd 50 | |
lt 180 | |
lt 90 | |
fd 50 | |
rt 90 | |
pendown | |
repeat 360(sequence[lt 1, fd 1]) | |
fd 150 |
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
describe clCreateContext do | |
let(:params) { nil } | |
subject { clCreateContext(params) } | |
context "when calling with nil mooses" do | |
let(:params) { mooses: nil } | |
its(:errcode_ret) { should == CL_INVALID_MOOSE } | |
end | |
end |
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
This seems to run quicker than the jshint-mode example (https://github.com/daleharvey/jshint-mode) as it doesn't set up a node server each time. | |
1. Install node and get jshint | |
$ brew install node | |
$ npm install -g jshint | |
2. Update PATH to point to Node Packagem Manager bin directory |
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 strict; | |
# Kind of useless script to convert numbers to their word equivalent and back | |
# Call dec_to_str() with a decimal value, returns a string containing the word equivalent | |
# eg. dec_to_str(123456) := one hundred and twenty three thousand four hundred and fifty six | |
# Call str_to_dec() with a number in words, returns decimal value |
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 | |
/* Crop images */ | |
/* Find whitespace around image and remove */ | |
$border = 5; | |
/* Get image */ | |
$orig = getImage($argv[1]); |