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
angular.module('example') | |
.factory('Users', function($q, $http) { | |
var users = null; | |
return { | |
get: function() { | |
deferred = $q.defer(); | |
if (users) { | |
deferred.resolve(users); |
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
# Set prefix key to Ctrl-a | |
set -g prefix C-a | |
unbind C-b | |
# Send C-a to apps when presses twice | |
bind C-a send-prefix | |
# Shorter delay between key strokes | |
set -s escape-time 1 |
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[dir=rtl] { | |
#dsq-content ul, #dsq-content li, #dsq-content ol, #dsq-content cite, | |
#dsq-content div, #dsq-content table, #dsq-content td, #dsq-content th, | |
#dsq-content p, #dsq-content a, #dsq-content img, #dsq-content caption { | |
text-align: right; } | |
#dsq-content { | |
.dsq-options span { margin-right: 0; margin-left: 10px; } | |
.dsq-request-user-logout { float: left; } | |
.dsq-request-user-name { padding: 0.25em 0.5em 0 0; vertical-align: top; direction:ltr } | |
.dsq-post-footer .dsq-button { float: left; margin-right: 3px; margin-left:0;} |
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
#!/usr/bin/env python | |
from tornado import ioloop, web, gen, options | |
import motor | |
import json | |
DEFAULT_TENANT = 'default' # If Host not found, which default service to Use | |
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 I18NTag(TagBase): | |
"""Extend Taggit's Tag: | |
* Add a language field | |
* slug unique with language field | |
""" | |
language = models.CharField(max_length=5, choices=settings.LANGUAGES, | |
blank=True, default=settings.LANGUAGE_CODE) | |
slug = models.SlugField(unique=False, max_length=100) |
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
def humanize_number(size) | |
return '0' if size == 0 | |
bytes = %w(B KB MB GB TB PB EB ZB YB) | |
cnt = Math.log(size, 1024).floor | |
size = size / 1024.0 ** cnt | |
fmt = size < 10 ? '%.1f %s' : '%i %s' | |
sprintf(fmt, size , bytes[cnt]) |
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
{$mode objfpc}{$M+} | |
program test; | |
type | |
TMyClass = class | |
// Must be with RTTI view | |
procedure SayHi; | |
end; | |
procedure TMyClass.SayHi; |