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
func parseAddr(spec string) (p string, a string, e error) { | |
split := strings.Split(p, "://") | |
switch len(split) { | |
case 1: | |
p = "tcp" | |
a = split[0] | |
case 2: | |
p = strings.ToLower(split[0]) | |
a = split[1] |
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 cla_block_view($delta = '') | |
{ | |
$block = array(); | |
switch ($delta) { | |
case 'cla': | |
$block['subject'] = t('Custom login actions'); | |
$block['contents'] = array( | |
'#type' => 'markup', |
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
ActiveAdmin.register User do | |
controller do | |
def update_resource(object, attributes) | |
update_method = attributes.first[:password].present? ? :update_attributes : :update_without_password | |
object.send(update_method, *attributes) | |
end | |
def scoped_collection | |
User. | |
joins('LEFT OUTER JOIN states ON states.user_id = users.id'). |
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
#!/usr/bin/env python3 | |
import urwid | |
import urwid.curses_display | |
import os | |
import re | |
import signal | |
from operator import itemgetter | |
from urwid.canvas import CompositeCanvas |
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 | |
function streaming_data_node_info() | |
{ | |
return array( | |
'frontend' => array( | |
'name' => t('Streaming server'), | |
'base' => 'streaming_data_frontend', | |
'description' => t('A server that will broadcast video stream to users.'), | |
'help' => t('Stream-proxy instance that will request configuration.'), | |
'has_title' => true, |
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
package main | |
import ( | |
"net/http" | |
"net/url" | |
"encoding/json" | |
"fmt" | |
"os" | |
"log" | |
) |
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
#ifndef __BIT_OPS__ | |
#define __BIT_OPS__ | |
#ifndef _BV | |
#define _BV(x) (1 << (x)) | |
#endif | |
/* #!ruby | |
* | |
* # generator for bitN macroes |
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
$form['actions']['reset'] = array( | |
'#type' => 'markup', | |
'#markup' => format_string('<input type="reset" value="@value" class="form-submit" id="edit-reset" />', array( | |
'@value' => t('Reset') | |
)) | |
); | |
$form['actions']['submit'] = array( | |
'#type' => 'button', |
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
#include <avr/io.h> | |
int main(void){ | |
TCCR1A |= (1 << COM1A1) | (1 << WGM11) | (1 << WGM10); | |
TCCR1B |= (1 << CS12); | |
DDRB |= (1 << PB1); | |
while(1){} | |
return 0; | |
} |
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 app = angular.module('samlib', ['ui.modal']); | |
app.config(['$httpProvider', function($httpProvider){ | |
$httpProvider.responseInterceptors.push('httpRestarter'); | |
}]); | |
app.factory('httpRestarter', ['$q', '$injector', '$timeout', 'notifier', function($q, $injector, $timeout, notifier){ | |
var $http; | |
return function(r){ |