Skip to content

Instantly share code, notes, and snippets.

View belonious's full-sized avatar

Amarantidis Vasileios belonious

View GitHub Profile
<button ng-click="toggleUserStatus(user.status)">
<span ng-show="user.status == 'inactive'">Activate</span>
<span ng-show="user.status == 'active'">Deactivate</span>
</button>
//inside ctrl
$scope.user = {
status : 'active'
// more props here
/**
*
* @param items {Array} array of GM items
* @param eventType {String}
* @param handler {Function}
* @param handlerArgs {Function}
*/
var addHandlers = function (items, eventType, handler, handlerArgs) {
_.forEach(items, function (item) {
google.maps.event.addListener(item, eventType, handler.bind.apply(handler, [null].concat(handlerArgs)));
url(
r'^forgot-password/$',
'django.contrib.auth.views.password_reset',
name="forgot password"
),
(r'^account/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm',
{'post_reset_redirect' : '/account/password/done/'}),
(r'^account/password/done/$', 'django.contrib.auth.views.password_reset_complete'),
var reFirst = new RegExp("(\\d*\\.?\\d+)([*\\/])([-]?)(\\d*\\.?\\d+)", "");
var reSecond = new RegExp("(\\d*\\.?\\d+)([+-])([-]?)(\\d*\\.?\\d+)", "");
var brackets = /[(]([^(]+?)[)]/gm;
var prn = function (text) {
text.replace(/([-][-]|[-][+]|[+][-])/g,'-');
text = calcOurs(reFirst, text);
text = calcOurs(reSecond, text);
return text;
};
/**
* sort's
* @param entities {Array}
* @returns {Array}
*/
ordering = function (entities) {
var sortedRes = _.sortBy(entities, 'originalIndex');
var first = sortedRes.splice(0, 10);
var original = [
{
id: 11
},
{
id: 5
},
{
id: 6
},
#python 2.7
i_str, i_lst, result = " bill == @0, john == @1, maria = @2", [234, "mple", 0], " bill == 234, john == mple, maria = 0"
def specsMatch(input_str,input_list):
r = []
for index,i in enumerate(i_str.split(',')):
r.append(i.split('@')[0] + str(i_lst[index]) + ',')
r[-1] = r[-1][:-1]
return "".join(r)
#python 2.7
i_str, i_lst, result = " bill == @0, john == @1, maria = @2", [234, "mple", 0], " bill == 234, john == mple, maria = 0"
def specsMatch(input_str,input_list):
r = [i.split('@')[0] + str(input_list[index]) + ',' for index,i in enumerate(input_str.split(','))]
r[-1] = r[-1][:-1]
return "".join(r)
if __name__ == '__main__':
@belonious
belonious / gist:d73aa2501bc37f56a440
Created August 14, 2014 13:29
jitsu error snapshot
info: jitsu v0.13.18, node v0.10.22
info: It worked if it ends with Nodejitsu ok
info: Executing command snapshots create
info: Analyzing application dependencies in node server
info: Creating snapshot 0.0.0-1
info: Uploading: [=============================] 100%
error: Error running command snapshots create
error: Error building snapshot
error: Nodejitsu Error (500): Internal Server Error
help: For help with this error contact Nodejitsu Support: