Skip to content

Instantly share code, notes, and snippets.

@kimek
kimek / download_files_from_googledrive.py
Created January 23, 2024 17:18 — forked from swyoon/download_files_from_googledrive.py
A script for downloading all files in a Google Drive folder.
"""
A Python script for downloading all files under a folder in Google Drive.
Downloaded files will be saved at the current working directory.
This script uses the official Google Drive API (https://developers.google.com/drive).
As the examples in the official doc are not very clear to me,
so I thought sharing this script would be helpful for someone.
To use this script, you should first follow the instruction
in Quickstart section in the official doc (https://developers.google.com/drive/api/v3/quickstart/python):
@kimek
kimek / oneliners.js
Created April 2, 2019 07:53 — forked from mikowl/oneliners.js
👑 Awesome one-liners you might find useful while coding.
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// Type this in your code to break chrome debugger in that line.
@kimek
kimek / .htaccess
Created March 15, 2019 12:19 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@kimek
kimek / README.md
Created January 17, 2019 09:15 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

Debugger listening on ws://127.0.0.1:9229/e472b5c0-26a2-429d-88c8-c98f8ff440a0
For help see https://nodejs.org/en/docs/inspector
[16:41:06] Failed to take screenshot on reject: {"type":"NoSessionIdError","message":"A session id is required for this command but wasn't found in the response payload"}
ERROR: unknown error: Chrome failed to start: exited normally
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.9.0-3-amd64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15.57 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'delta', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.0-3-amd64', java.version: '1.8.0_181'
@kimek
kimek / components.my-child.js
Last active March 23, 2018 08:34
Checkbox manual select, after that dynamic deselect issue
import Ember from 'ember';
export default Ember.Component.extend({
isChecked: Ember.computed('parentIsChecked',function() {
return this.get('parentIsChecked');
}),
});
@kimek
kimek / gist:b59617bd04fafad160f8ed8448919af3
Created May 23, 2017 16:46
Get first postcode part from UK postcode with vanilla javascript
function postcodePart($postcode) { //https://www.mrs.org.uk/pdf/postcodeformat.pdf
var $postcodePart;
switch($postcode.length) {
case 5:
$postcodePart = $postcode.substr(0,2)
break;
case 6:
$postcodePart = $postcode.substr(0,3)
break;
case 7:
@kimek
kimek / scroller.js
Created May 16, 2017 12:24 — forked from Cosmicist/scroller.js
Vanilla Javascript Scrolling function for easing based scrolling
var Scroller = function(anchors, config)
{
var cfg = compile({
duration: 1000,
offset: 0,
easing: Scroller.easing.inOutQuad,
callback: function() {}
}, config);
[].forEach.call(anchors, function(anchor) {
@kimek
kimek / setup_selenium.sh
Created May 4, 2017 15:13 — forked from curtismcmullan/setup_selenium.sh
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in