Skip to content

Instantly share code, notes, and snippets.

Sinan Güçlü Driptap

Block or report user

Report or block Driptap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Driptap
Driptap / package.json
Last active Jul 25, 2018
Simple stylus plugin that uses Staticfy replace paths to replace static asset paths in compiled css
View package.json
{
"name": "stylus-staticify",
"version": "0.1.0",
"main": "stylus-staticify.js",
"peerDependencies": {
"staticify": "^3.0.0",
}
}
View package.json
{
"name": "sequlize_user_model",
"version": "0.1.0",
"main": "sequlize_user_model.js"
}
@Driptap
Driptap / Node.js CORS
Created Jun 13, 2018 — forked from nilcolor/Node.js CORS
Node.js cross-origin POST. You should response for OPTIONS request first. Something like this.
View Node.js CORS
if (req.method === 'OPTIONS') {
console.log('!OPTIONS');
var headers = {};
// IE8 does not allow domains to be specified, just the *
// headers["Access-Control-Allow-Origin"] = req.headers.origin;
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
headers["Access-Control-Allow-Credentials"] = false;
headers["Access-Control-Max-Age"] = '86400'; // 24 hours
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
@Driptap
Driptap / test_helpers.js
Created May 22, 2018
Faker.js and Rosie.js helpers
View test_helpers.js
const randomIntBetween = (min, max, string = false) => {
let int = Faker.random.number() % max + min;
return string ? String(int) : int;
};
View Iterator prototype extensions
Object.defineProperty(Array.prototype, 'findAll', {
enumerable: false,
writable: false,
value: condition => this.reduce((col, el, i) =>
condition(el, i, this) ? [...col, el] : col, [])
});
Object.defineProperty(Array.prototype, 'exists', {
enumerable: false,
writable: false,
@Driptap
Driptap / index.html
Created Mar 3, 2018
Serving templates from static files
View index.html
<html>
<head>
<script src="/rendered_statics/script.js"></script>
</head>
<body>
</body>
</html>
View Python Debugger
import pdb; pdb.set_trace()
import ipdb; ipdb.set_trace()
View spider.html
<html>
<head>
</head>
<body style="background: black; position: fixed; top:0; left:0; right: 0; bottom: 0;">
<canvas id='demo-canvas'></canvas>
<div id='large-header'></div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.1/TweenLite.min.js" integrity="sha256-Y7X151r2Tk9/N3WcxW1qQn/phEPJ9mY8uOxqaI4AWW4=" crossorigin="anonymous"></script>
@Driptap
Driptap / deep_clone.js
Last active May 23, 2017
ES6 Implementation of lodash's cloneDeep function using underscore
View deep_clone.js
/**
* Creates a deep clone of an object using underscore.
*/
import {clone, each, isObject} from 'underscore';
const deepClone = (_obj) => {
let _clone = clone(_obj);
each(_clone, (_val, _key) => {
if (isObject(_val))
@Driptap
Driptap / web_workers.js
Last active Dec 15, 2016
Simple web workers
View web_workers.js
var App = App || {};
/* ===================================== WEB WORKERS LISTENER ========================*/
App.workers = function(options) {
"use strict";
var that = {},
_storage = localStorage,
_storedConfig = _storage.getItem('workers_config'),
_config = (_storedConfig) ? _storedConfig : {
You can’t perform that action at this time.