Skip to content

Instantly share code, notes, and snippets.

@RyanHarijanto
RyanHarijanto / bootstrap-3-starter-template-cdn.html
Created April 21, 2017 21:56
Bootstrap 3 Starter Template (CDN)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 3 Starter Template (CDN)</title>
<!-- Bootstrap -->
@RyanHarijanto
RyanHarijanto / .gitlab-ci.yml
Last active April 17, 2017 23:11
.gitlab-ci.yml: Build Docker Image
# This file is a template, and might need editing before it works on your project.
# Official docker image.
image: docker:latest
services:
- docker:dind
build:
stage: build
script:
# $DOCKERHUB_USER is NOT your email address, it's your username!
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"
@RyanHarijanto
RyanHarijanto / .gitlab-ci.yml
Last active October 4, 2023 21:28
.gitlab-ci.yml example: multiple Docker images
# The folders below will be cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
- _site # or other arbitrary directory
stages:
- build
- test
@RyanHarijanto
RyanHarijanto / blockthem-js-jquery-example.js
Last active October 3, 2015 18:32
BlockThem Javascript/jQuery (Browser) Example
var json = null;
$.ajax({
'global': false,
'url': '//api.blockthem.io/v1/blacklist.json',
'dataType': "json",
'success': function (data) {
json = data;
}
});
@RyanHarijanto
RyanHarijanto / blockthem-python2-example.py
Created October 3, 2015 10:00
BlockThem Python2 Example
#!/usr/bin/python
import urllib2
import json
import re
def isDomainBlockedLive( domain, jsonFile ):
domain = re.sub(r'http(s?):\/\/', '', domain)
domain = re.sub(r'^www\.', '', domain)
domain = re.sub(r'\/$', '', domain)
headers = { 'User-Agent' : 'Mozilla/5.0' }
@RyanHarijanto
RyanHarijanto / blockthem-python2-example.py
Last active October 3, 2015 09:57
BlockThem Python2 Example
#!/usr/bin/python
import urllib2
import json
import re
def isDomainBlockedLive( domain, jsonFile ):
domain = re.sub(r'http(s?):\/\/', '', domain)
domain = re.sub(r'^www\.', '', domain)
domain = re.sub(r'\/$', '', domain)
headers = { 'User-Agent' : 'Mozilla/5.0' }
@RyanHarijanto
RyanHarijanto / blockthem-ruby-example.rb
Last active October 3, 2015 09:50
BlockThem Ruby Example
#!/usr/bin/ruby
require 'net/http'
require 'uri'
require 'json'
def isDomainBlockedLive(domain, jsonFile)
domain = domain.sub(/http(s?):\/\//, '').sub(/^www\./, '').sub(/\/$/, '')
list = JSON.parse(Net::HTTP.get(URI.parse(jsonFile)))
return list.include? domain
@RyanHarijanto
RyanHarijanto / blockthem-php-example.php
Last active October 3, 2015 09:50
BlockThem PHP Example
<?php
function isDomainBlocked($domain, $jsonFile) {
$domain = preg_replace('/^http(s?)\:\/\//', '', $domain);
$domain = preg_replace('/^www\./', '', $domain);
$domain = preg_replace('/\/$/', '', $domain);
$list = json_decode(file_get_contents($jsonFile), true);
return in_array($domain, $list);
}
// Example: Live