This file contains hidden or 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
//: Playground - noun: a place where people can play | |
import UIKit | |
//lets to trya strategy pattern! | |
protocol QCallKit{ | |
func dial() | |
func endCall() | |
func accept() |
This file contains hidden or 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 | |
// this script was created by Akbar Taufiq Herlangga (Software Engineer at Qiscus) | |
// this script was created for the Qiscus TechTalk #35 - Build Your Own MVC Framework | |
////////////////////////////////////////////////////////////////////// | |
//////////////////////////// M O D E L /////////////////////////////// |
This file contains hidden or 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
def poll | |
last_post = params[:last_post] | |
def check | |
r = Post.all.order(:created_at => "ASC").last | |
if r.message != last_post | |
return true | |
else | |
return false | |
end |
This file contains hidden or 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
import re | |
f = open("1.in", "r") | |
N = int(f.readline()) | |
a = 26 | |
for i in range(N): | |
mydict = {} | |
total = 0 | |
input = f.readline() | |
input = re.sub('[^A-Za-z0-9]+', '', input) | |
input = input.lower() |
This file contains hidden or 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 'base64' | |
require 'openssl' | |
require 'digest/sha1' | |
secret_key = "5J0VAOMMkrh5mYEJN4WuybZXfLFQMI" | |
policy_document = '{"expiration": "2013-01-01T00:00:00Z", | |
"conditions": [ | |
{"bucket": "evanpurnama"}, |
This file contains hidden or 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
N = gets.to_i | |
a = [0]*(N) | |
for i in 0..(N-1) do | |
a[i] = gets.to_i | |
end | |
n = [1]*(N) |
This file contains hidden or 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
function post_request($url, $data, $referer='') { | |
// Convert the data array into URL Parameters like a=b&foo=bar etc. | |
$data = http_build_query($data); | |
// parse the given URL | |
$url = parse_url($url); | |
if ($url['scheme'] != 'http') { | |
die('Error: Only HTTP request are supported !'); |
This file contains hidden or 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
tmd = 0 | |
while 1 | |
t = Time.now | |
tm = t.sec | |
if tm%30 == 0 | |
tmo = tm | |
if tmd == 0 | |
puts Time.now | |
file = File.open("iptime.txt","w") | |
file.write(Time.now) |
This file contains hidden or 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
from django.core.urlresolvers import get_callable | |
from django.template import TemplateDoesNotExist | |
from django.template.loader import BaseLoader | |
from django.template.context import BaseContext | |
from django.conf import settings | |
import jinja2 | |
def monkey_patch_django(): |