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
HTML: | |
<a href="#" data-lang-string='{"show":"{{ Lang::get('header.show_menu') }}", "hide":"{{ Lang::get('header.hide_menu') }}"}' id="toggle_navigation">{{ Lang::get('header.show_menu') }}</a> | |
JAVASCRIPT: | |
$("#toggle_navigation").data('lang-string').show; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script> | |
$(document).ready(function() | |
{ | |
$("#toggle_link").click(function(event){ | |
event.preventDefault(); | |
var heightExpanded = $("#box").get(0).scrollHeight - 2 * parseInt($("#box").css('padding')); |
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 imaplib | |
import StringIO | |
import rfc822 | |
obj = imaplib.IMAP4_SSL("imap.gmail.com", "993") | |
obj.login("[email protected]", "pass") | |
print obj.list() | |
obj.select("[Gmail]/Vsa po&AWE-ta") | |
m = obj.search(None, "ALL")[1][0] | |
alli = m.split() |
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
# Load environment variable into Django settings. | |
# Usage: SOME_SECRET_KEY = get_env_variable("SOME_SECRET_KEY") | |
import os | |
from django.core.exceptions import ImproperlyConfigured | |
def get_env_variable(var_name): | |
""" Get the environment variable or return exception """ | |
try: | |
return os.environ[var_name] |
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 java.io.InputStream; | |
import java.net.Socket; | |
import java.util.Date; | |
public class Rdate { | |
public static void main(String[] args) { | |
try { | |
Socket s = new Socket("ntp1.arnes.si", 37); | |
InputStream input = s.getInputStream(); |
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
var image = new Image(); | |
image.src = "sample.jpg"; | |
$(image).load(function() { | |
ctx.drawImage(image, 0, 0); | |
}); | |
$(canvas).click(function(e) { | |
var canvasOffset = $(canvas).offset(); | |
var canvasX = Math.floor(e.pageX-canvasOffset.left); | |
var canvasY = Math.floor(e.pageY-canvasOffset.top); |
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
Packages: | |
"Package Control" | |
"Gist" | |
"Clipboard History" | |
"Emmet" | |
"AdvancedNewFile" | |
"Nettuts+ Fetch" | |
"Goto Documentation" | |
"Prefixr" | |
"SublimeLinter" |
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 get_data_and_labels(images_filename, labels_filename): | |
print("Opening files ...") | |
images_file = open(images_filename, "rb") | |
labels_file = open(labels_filename, "rb") | |
try: | |
print("Reading files ...") | |
images_file.read(4) | |
num_of_items = int.from_bytes(images_file.read(4), byteorder="big") | |
num_of_rows = int.from_bytes(images_file.read(4), byteorder="big") |
NewerOlder