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
//If we will use Paginator component in many actions add it to $components field: | |
public $components = array('Paginator'); | |
//otherwise do it locally, inside action: | |
$this->Paginator = $this->Components->load('Paginator'); | |
//optionally we can set conditions etc. (like in finding): |
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
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <regex> | |
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems){ | |
std::stringstream ss(s); | |
std::string item; | |
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 lightblue | |
server_sock = lightblue.socket() | |
server_sock.bind(("", 0)) | |
server_sock.listen(1) | |
lightblue.advertise("RFCOMM mini server", server_sock, lightblue.RFCOMM) | |
client_sock, client_info = server_sock.accept() | |
print "Accepted connection from ", client_info |
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
case MotionEvent.ACTION_UP: { | |
for (int a = 0; a < MoveList.size(); a++) { | |
String zxc = MoveList.get(a).toString(); | |
qwe = qwe + zxc + "\n"; | |
} | |
MyActivity.prevtextview.setText("Prev_angle: " + String.valueOf(mPrevAngle)); | |
MyActivity.currtextview.setText("Curr_angle List: " + String.valueOf(qwe)); |
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
//add it to your build.gradle | |
//every time when your will call task crashlyticsUploadSomethingSomething it will be called before it | |
//and it will crash if you have some uncommited changes in your working copy. | |
// | |
//I'm using this because I need git sha1 for app versioning in development versions. | |
task everythingGitCommited << { | |
def checkChanges = 'git status -uno --porcelain'.execute([], project.rootDir).text.trim() |
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
android { | |
signingConfigs { | |
release { | |
storeFile file(fileConfig['keystore_dir']) | |
storePassword fileConfig['keystore_password'] | |
keyAlias fileConfig['key_alias'] | |
keyPassword fileConfig['key_password'] | |
} | |
} | |
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
// Custom tasks | |
/** | |
* This test make sure if we have everything committed (or stashed). Allows keep project clean | |
* and with even small change crashlytics beta upload will have different SHA1. | |
*/ | |
task testGitWorkingCopy << { | |
def checkChanges = 'git status -uno --porcelain'.execute([], project.rootDir).text.trim() |
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
/** | |
* Sample oauth2 based on code flow | |
*/ | |
public class MainActivity extends AppCompatActivity { | |
private static final String REDIRECT_URL = "http://redirect.com"; | |
private static final String CLIENT_ID = "your_client_id(oauth_key)"; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
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
# Simple script that generate all possible string combinations for given lenght | |
# and generates sha256 hashes for every combination. Combination allow to use | |
# single char zero or more times. | |
import hashlib | |
import itertools | |
possibleChars = ['a', 'l', 'i', 'n', 's', 'b'] | |
passLen = 7 |
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
public static class FadeoutBehavior extends CoordinatorLayout.Behavior<View> { | |
private int startPos = 0; | |
private int finalPos = 0; | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { | |
return dependency instanceof AppBarLayout; | |
} |
OlderNewer