Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Harijanto RyanHarijanto

View GitHub Profile
View bootstrap-3-starter-template-cdn.html
<!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 Apr 17, 2017
.gitlab-ci.yml: Build Docker Image
View .gitlab-ci.yml
# 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 Jul 10, 2020
.gitlab-ci.yml example: multiple Docker images
View .gitlab-ci.yml
# 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 Oct 3, 2015
BlockThem Javascript/jQuery (Browser) Example
View blockthem-js-jquery-example.js
var json = null;
$.ajax({
'global': false,
'url': '//api.blockthem.io/v1/blacklist.json',
'dataType': "json",
'success': function (data) {
json = data;
}
});
View blockthem-python2-example.py
#!/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' }
View blockthem-python2-example.py
#!/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' }
View blockthem-ruby-example.rb
#!/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
View blockthem-php-example.php
<?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
You can’t perform that action at this time.