git discard all local changes/commits and pull from upstream
git reset --hard origin/master
git pull origin master
To ignore file:
git checkout pom.xml
To perform a pull:
| <?php | |
| /** | |
| * The __halt_compiler() function will stop the PHP compiler when called. | |
| * You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt. | |
| * In this example a PHP template is stored after the halt, to allow simple separation of logic from templating. | |
| * The template is stored in a temporary file so it can be included and parsed. | |
| * | |
| * See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php | |
| * http://php.net/manual/en/function.halt-compiler.php | |
| */ |
| <?php | |
| $deviceToken = $_POST['dt']; | |
| $body = $_POST['b']; | |
| if (empty($deviceToken)){ | |
| die ("nothing to do, no device. exit"); | |
| } | |
| #API access key from Google API's Console | |
| define( 'API_ACCESS_KEY', '' ); | |
| #prep the bundle |
| <?php | |
| //create random hash, please notice $6$ as first chars in salt string | |
| $salt = "$6$5e2de398074f9213"; | |
| $hash = crypt('pswt1', $salt); | |
| echo $hash; | |
| //mariaDB compatible code: select ENCRYPT('pswt1', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))); | |
| echo "<hr>"; |
| /* | |
| Cookies can only store strings. Therefore, you need to convert your array of objects into a JSON string. | |
| If you have the JSON library, you can simply use JSON.stringify(people) and store that in the cookie, | |
| then use $.parseJSON(people) to un-stringify it. | |
| In the end, your code would look like: | |
| */ | |
| var people = [ | |
| { 'name' : 'Abel', 'age' : 1 }, | |
| { 'name' : 'Bella', 'age' : 2 }, |
| /** | |
| * Modify the parts you need to get it working. | |
| */ | |
| var should = require('should'); | |
| var request = require('../node_modules/request'); | |
| var io = require('socket.io-client'); | |
| var serverUrl = 'http://localhost'; |
git discard all local changes/commits and pull from upstream
git reset --hard origin/master
git pull origin master
To ignore file:
git checkout pom.xml
To perform a pull:
| drop table ba_paper_keyword; | |
| create table ba_paper_keyword as | |
| ( | |
| select p.id, p.keyword, count(p.keyword) count | |
| from | |
| (select id | |
| , trim (both ';,.:?()"' from regexp_split_to_table(lower(paper.keyword), E'\\\s+')) AS keyword | |
| from paper)p | |
| group by p.id, p.keyword | |
| ) |
| if (window.innerWidth > 640) { | |
| var floatParentNode = document.querySelector('.js-parent'); | |
| var floatNode = document.querySelector('.js-float'); | |
| var valScrollForFixed = floatParentNode.getBoundingClientRect().top + window.pageYOffset - document.querySelector('.js-header').offsetHeight; | |
| window.addEventListener('scroll', function () { | |
| if (window.innerHeight > floatNode.offsetHeight) { | |
| var windowScrollTop = window.pageYOffset; | |
| var footerTop = document.querySelector('.js-footer').getBoundingClientRect().top + windowScrollTop; | |
| var footerHeight = document.querySelector('.js-footer').clientHeight; |
| // http://learn.javascript.ru/external-script | |
| function addScript(src){ | |
| var script = document.createElement('script'); | |
| script.src = src; | |
| script.async = false; // чтобы гарантировать порядок | |
| document.head.appendChild(script); | |
| } | |
| addScript('1.js'); // загружаться эти скрипты начнут сразу |
| // http://frontender.info/essential-javascript-functions/ | |
| // Возвращает функцию, которая не будет срабатывать, пока продолжает вызываться. | |
| // Она сработает только один раз через N миллисекунд после последнего вызова. | |
| // Если ей передан аргумент `immediate`, то она будет вызвана один раз сразу после | |
| // первого запуска. | |
| function debounce(func, wait, immediate) { | |
| var timeout; | |
| return function() { | |
| var context = this, args = arguments; | |
| var later = function() { |