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
| classname = 'NewClass' | |
| tablename = 'table' | |
| session = scoped_session(sessionmaker(bind=engine)) | |
| classobj = Base._decl_class_registry.get(classname) | |
| if classobj: | |
| session.bind_table(classobj.__table__, engine) | |
| return classobj | |
| if tablename in Base.metadata.tables.keys(): | |
| Base.metadata.remove(Base.metadata.tables[tablename]) |
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
| description "PHP FastCGI Process Manager" | |
| kill signal INT | |
| start on {net-device-up and local-filesystems} | |
| stop on runlevel [016] | |
| expect fork | |
| respawn | |
| exec /usr/sbin/php5-fpm |
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
| fizzbuzz = lambda num: ('fizz' if not num % 3 else '') + ('buzz' if not num % 5 else '') |
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 multiprocessing | |
| import functools | |
| def ignore_keyboard_interrupt(f): | |
| @functools.wraps(f) | |
| def wrapper(*args, **kwargs): | |
| try: | |
| return f(*args, **kwargs) | |
| except KeyboardInterrupt: |
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
| # scancode | |
| maki@marou:~> sudo showkey --scancodes | |
| # key codes確認 | |
| maki@marou:~> xmodmap -pke | |
| # USBのvendor id, product id検索 | |
| maki@marou:~> lsusb | |
| Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB |
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
| maki@marou:/etc/fonts/conf.d> cat 40-nonlatin.conf | |
| <?xml version="1.0"?> | |
| <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
| <fontconfig> | |
| <!-- | |
| Mark common families with their generics so we'll get | |
| something reasonable | |
| --> | |
| <!-- |
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
| App.config(['$httpProvider', | |
| function($httpProvider) { | |
| $httpProvider.defaults.useXDomain = true; | |
| $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; | |
| $httpProvider.interceptors.push('myHttpResponseInterceptor'); | |
| $httpProvider.defaults.transformRequest = function(data) { | |
| // $resourceを使用する場合はtypeを判定してfunction, objectを除く必要がある。 | |
| var params = {}; | |
| var i = 0; | |
| if (data) { |
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
| app.directive('directiveName', function($location) { | |
| return { | |
| priority: 99, | |
| link: function (scope, element, attrs) { | |
| console.log(attrs); | |
| } | |
| }; | |
| }); |
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
| when('/sample/:id', { | |
| templateUrl: 'sample.html', | |
| controller: 'sampleController', | |
| resolve: { | |
| media: function(resource, $route) { | |
| return resource.get({id: $route.current.params.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
| var fd = new FormData(); | |
| fd.append('file', $('input[type=file]')[0].files[0]); | |
| $.ajax({url: 'api/thread/' + thread + '/upload', | |
| type: 'POST', | |
| data: fd, | |
| processData: false, | |
| contentType: false | |
| }).done(function() { | |
| document.location.reload(); | |
| }); |
OlderNewer