Skip to content

Instantly share code, notes, and snippets.

View cheeyeo's full-sized avatar
💭
Researching on use of transformers in computer vision

Chee Yeo cheeyeo

💭
Researching on use of transformers in computer vision
View GitHub Profile
@ismasan
ismasan / bootic_oauth2.rb
Created October 7, 2013 18:14
Interact with Bootic auth and API using the oauth2 gem.
require 'oauth2'
# Instantiate client
client = OAuth2::Client.new(
ENV['BOOTIC_CLIENT_ID'],
ENV['BOOTIC_CLIENT_SECRET'],
site: 'https://api.bootic.net',
authorize_url:'https://auth.bootic.net/oauth/authorize',
token_url:'https://auth.bootic.net/oauth/token'
)
@ugisozols
ugisozols / gist:6778058
Last active April 4, 2019 17:18
Refinery CMS + Dragonfly + Amazon S3 + Amazon Cloudfront
# config/environments/production.rb:
config.action_controller.asset_host = "http://cdn%d.example.com"
# config/initializers/refinery/images.rb:
config.dragonfly_url_format = "/images/:job/:basename.:ext"
if Rails.env.production?
config.dragonfly_url_host = "http://cdn4.example.com"
end
# config/initializers/refinery/resources.rb:
@ismasan
ismasan / Procfile
Created September 24, 2013 14:41 — forked from pboling/Procfile
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
critical: env HEROKU_PROCESS=critical bundle exec sidekiq -c 2 -q critical,4
default: env HEROKU_PROCESS=default bundle exec sidekiq -c 4 -q default,2
low: env HEROKU_PROCESS=low bundle exec sidekiq -c 1 -q low,1
@jbwyme
jbwyme / mixpanel-2.2-amd-syncronous.html
Last active December 23, 2015 18:39
Mixpanel 2.2 AMD/Require example #1: Sync This method works by creating a pre-init module to setup the window.mixpanel deps needed by the mixpanel lib and then specifying that as a dependency to the lib itself. Then requiring "mixpanel" will block until the lib is fully loaded.
<html>
<head>
<title>Mixpanel AMD Example - Sync</title>
<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.8/minified/require.js"></script>
<script type="text/javascript">
requirejs.config({
paths : { 'mixpanel': "//cdn.mxpnl.com/libs/mixpanel-2.2.min" },
shim: {
'mixpanel': {
deps: ['mixpanel-preinit'],
#!/bin/bash
# Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/
# Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site.
read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)."
echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion."
curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx"
echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion."
@oisin
oisin / gist:6328241
Created August 24, 2013 13:49
Building Erlang from source on OS X 10.9 - don't forget SSL
# Get the 1.0.1 version of SSL
brew install openssl
./configure --disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --enable-darwin-64bit --with-ssl=/usr/local/opt/openssl
touch lib/wx/SKIP lib/odbc/SKIP
make -j4
sudo make install
@ismasan
ismasan / celluloid_futures_json_request.rb
Last active December 21, 2015 04:49
Using Celluloid futures to make concurrent HTTP requests
require "open-uri"
require 'json'
require 'celluloid/autostart'
def json(url)
JSON.parse(open(url, 'Authorization' => 'Bearer API TOKEN').read)
end
class Resource
@ismasan
ismasan / concurrent_bootic_products.rb
Created August 16, 2013 17:46
Use futures to fetch all products in a page concurrently. With futures: ~5 seconds Without: ~ 32 seconds
require "open-uri"
require 'json'
def json(url)
JSON.parse(open(url, 'Authorization' => 'Bearer API_TOKEN').read)
end
class Future < BasicObject
def initialize(callable)
@thread ||= ::Thread.new { callable.call }
@ismasan
ismasan / app.js
Last active December 20, 2015 18:49
// Bootic Ajax cart widget
// This function gets passed an instance of the Bootic.Cart class
// https://github.com/bootic/bootic_cart
// Ismael Celis 2013 for Bootic.net
// -----------------------------------------------------*/
;(function ($, cart, cartSelector, counterSelector) {
function loading () {
$('.loading', cartSelector).show()
}
Commit = Struct.new(:repo, :sha, :comment, :stats) do
def refactoring?(previous_commit)
return :spec_files_unchanged if no_changes_to_specs
return :comment if refactoring_comment
return false if result.nil? || result.failed > 0 || result.total == 0
return :spec_results_unchanged if result == previous_commit.result
return false
end
def no_changes_to_specs