View import_blog.rb
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 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby bimport_blog.rb blog_kamu.xml | |
data = File.read ARGV[0] | |
doc = Nokogiri::XML(data) |
View dot js
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
<script type="text/javascript"> | |
tinymce.init({ | |
selector: "textarea", | |
theme: "modern", | |
plugins: [ | |
"advlist autolink lists link image charmap print preview hr anchor pagebreak", | |
"searchreplace wordcount visualblocks visualchars code fullscreen", | |
"insertdatetime media nonbreaking save table contextmenu directionality", | |
"emoticons template paste textcolor" | |
], |
View README.md
Thue Morse Sequence - PHP Implementation
Recently, I got a job vacancy test and this is the one of questions i've got. I'm absolutely new here so CMIIW 😉
Usage
Simply download the gist and create new file called whatever.php
then copy-paste lines below:
!#/usr/bin/env php
View jne.php
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
<html> | |
<head> | |
<title>Check AWB</title> | |
<style type="text/css"> | |
BODY, TD, INPUT { | |
font-family:Geneva, Arial, Helvetica, sans-serif; | |
font-size: 12px; | |
} | |
INPUT.submit { |
View RajaOngkir Widget Code
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
<div data-theme="light" id="rajaongkir-widget"></div> | |
<script type="text/javascript" src="//rajaongkir.com/script/widget.js"></script> |
View yahoo-online-status-detection.php
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 | |
$yahooID = "YOUR_ID"; | |
$status = file_get_contents("http://opi.yahoo.com/online?u=".$yahooID."&m=a&t=1"); | |
if ($status === '00') { | |
echo "OFFLINE!"; | |
} else if ($status === '01') { | |
echo "ONLINE!"; |
View wp-xml-octopress-import.rb
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
# -*- coding: utf-8 -*- | |
require 'fileutils' | |
require 'date' | |
require 'yaml' | |
require 'uri' | |
require 'rexml/document' | |
include REXML | |
doc = Document.new File.new(ARGV[0]) |
View application_controller.rb
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
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def opensearch | |
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8' | |
end |
View authentications_controller.rb
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
class AuthenticationsController < ApplicationController | |
# This is the callback method from OmniAuth's GitHub authentication. | |
# following http://railscasts.com/episodes/236-omniauth-part-2 | |
def create | |
omniauth = request.env["omniauth.auth"] | |
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) | |
if authentication | |
sign_in_and_redirect(:user, authentication.user) | |
end | |
OlderNewer