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
| //helper method for clearCache() , recursive | |
| //returns number of deleted files | |
| fun clearCacheFolder(dir: File?, numDays: Int): Int { | |
| var deletedFiles = 0 | |
| if (dir != null && dir!!.isDirectory()) { | |
| try { | |
| for (child in dir!!.listFiles()) { | |
| //first delete subdirectories recursively |
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
| from django.contrib.auth.models import User | |
| from django.db.models.signals import post_save | |
| from django.dispatch import receiver | |
| from users.models import Profile | |
| @receiver(post_save, sender=User) | |
| def create_profile(sender, instance, created, **kwargs): | |
| if created: |
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
| ffmpeg -i "https://**.m3u8" -c copy -bsf:a aac_adtstoasc "output.mp4" | |
| ffmpeg -i "https://**.m3u8" -c copy -bsf:v h264_mp4toannexb "output.mp4" |
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 python | |
| from http.server import SimpleHTTPRequestHandler | |
| from socketserver import TCPServer | |
| import logging | |
| PORT = 8000 | |
| class GetHandler(SimpleHTTPRequestHandler): |
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
| ... | |
| @Override | |
| public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) { | |
| super.setPrimaryItem(container, position, object); | |
| NestedScrollView current = ((NestedScrollView)object); | |
| current.setNestedScrollingEnabled(true); | |
| for (int i = 0; i < getCount(); i++) { | |
| if (i != position) { | |
| NestedScrollView otherScrollView = container.findViewWithTag(i); |
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
| # dependencies: | |
| # - ffmpeg | |
| # - imagemagick | |
| # Usage: | |
| mkdir mp4_to_gif | |
| ffmpeg -i myfile.mp4 -vf scale=1024:-1:flags=lanczos,fps=10 mp4_to_gif/ffout%03d.png | |
| convert -loop 0 mp4_to_gif/ffout*.png output.gif | |
| rm -rf mp4_to_gif |
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 "fmt" | |
| func main() { | |
| s := []int{2, 3, 5, 7, 11, 13} | |
| printSlice(s) | |
| removeFirst(s) | |
| printSlice(s) |
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 org.mockito.configuration; | |
| import org.mockito.internal.stubbing.defaultanswers.ReturnsEmptyValues; | |
| import org.mockito.invocation.InvocationOnMock; | |
| import org.mockito.stubbing.Answer; | |
| import rx.Observable; | |
| import rx.Single; | |
| /** |
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
| if [ "${CONFIGURATION}" == "Release" ]; then | |
| cp -r "${PROJECT_DIR}/{PATH}/GoogleService-Info-release.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" | |
| echo "Production plist copied" | |
| elif [ "${CONFIGURATION}" == "Debug" ]; then | |
| cp -r "${PROJECT_DIR}/{PATH}/GoogleService-Info-debug.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" | |
| echo "Development plist copied" |
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
| <activity ..> | |
| <intent-filter> | |
| <action android:name="android.intent.action.VIEW" /> | |
| <category android:name="android.intent.category.DEFAULT" /> | |
| <category android:name="android.intent.category.BROWSABLE" /> | |
| <data android:scheme="http" /> | |
| <data android:scheme="https" /> | |
| <data android:host="www.mysite.com" /> | |
| </intent-filter> | |
| </activity> |