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 | |
import git | |
from email.utils import parsedate_tz | |
from time import strftime | |
def tree_walk(tree, path=''): | |
for name, obj in tree.items(): | |
if isinstance(obj, git.Tree): | |
for filename in tree_walk(obj, name): |
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 | |
# "Generate account passwords based on an account name and a master password." | |
from __future__ import print_function | |
try: | |
import argparse | |
except ImportError: | |
from . import argparse | |
try: |
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
#!/bin/bash | |
#from http://vvv.tobiassjosten.net/symfony/symfony2-cli-bash-script | |
PWD=$(pwd) | |
while [ "$PWD" != '/' ]; do | |
if [ -f "$PWD/app/console" ]; then | |
php "$PWD/app/console" $@ | |
exit |
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
_symfony2() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts=$(app/console list --xml | xmlstarlet sel -t -m "//namespaces//command" -v . -o " " | tr ":" "\:") | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
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
<?php | |
namespace Redeye\CuyBundle\Form\Extension\Core\DataTransformer; | |
use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer as BaseTransformer; | |
class NumberToLocalizedStringTransformer extends BaseTransformer | |
{ | |
/** | |
* {@inheritdoc} | |
*/ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Windows; | |
namespace WindowStateSave | |
{ | |
/// <summary> | |
/// Helper class that saves the window's state to a User Settings string |
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 | |
# -*- coding: utf-8 -*- | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2015 Carlos Zúñiga | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
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
import 'dart:convert'; | |
void main() { | |
// Json obtained through some api: | |
const jsonString = '[{"page":1, "items": [1, 2]}, {"page":2, "items": [3, 4]}]'; | |
final items = json.decode(jsonString); | |
final x = items.expand((p) => p['items']); | |
//final x = items.expand((p) => p['items'] as List<int>); | |
//final x = items.expand((p) => p['items'].map((i) => i as int)); | |
//final x = items.map((p) => p['items'] as List).toList().expand((i) => i).toList(); |