Skip to content

Instantly share code, notes, and snippets.

@esafwan
esafwan / WatermelonProvider.js
Last active October 10, 2022 12:47 — forked from sidferreira/WatermelonProvider.js
WatermelonDB preloaded db
import React, { ReactChild } from 'react';
import { Database } from '@nozbe/watermelondb';
import { getWatermelon } from 'app/utils/DBWatermelonOld/DBWatermelonOld';
import DatabaseProvider from '@nozbe/watermelondb/DatabaseProvider';
const WatermelonProvider = (props) => {
const watermelonRef = React.useRef();
const [database, setDatabase] = React.useState();
if (!watermelonRef.current) {
@esafwan
esafwan / d8-views-exp-form-alter.php
Created September 4, 2018 07:06 — forked from jez500/d8-views-exp-form-alter.php
Drupal 8 - Hook form alter views exposed form
<?php
/**
* Implements hook_form_alter().
*/
function MYMODULE_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
$view_names = array('my_view_name');
$view = $form_state->getStorage('view');
if ($form_id == 'views_exposed_form' && in_array($view['view']->id(), $view_names)) {
// Do some shilzzle.
@esafwan
esafwan / index.html
Created August 25, 2016 18:03 — forked from anonymous/index.html
Search Youtube Video via Js API // source http://jsbin.com/mawokik
<!doctype html>
<html>
<head>
<title>Search Youtube Video via Js API</title>
</head>
<body>
<div id="buttons">
<label> <input id="query" value='cats' type="text"/><button id="search-button" onclick="keyWordsearch()">Search</button></label>
<div id="container">
<h1>Search Results</h1>
<!DOCTYPE HTML>
<html>
<head>
<style id="jsbin-css">
body {
margin: 0px;
padding: 0px;
}
@esafwan
esafwan / datacenter_google.php
Created December 25, 2015 21:20 — forked from AurelienLavorel/datacenter_google.php
Use special DC for scrapping Google by LavoWeb
<?php
$dc = "173.194.44.35";
$tld = "com";
$ch = curl_init("http://" . $dc);
curl_setopt($ch, CURLOPT_HEADER, "Host: www.google." . $tld);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@esafwan
esafwan / chunker.py
Created November 28, 2015 14:45 — forked from mattiasostmar/chunker.py
A slight moderation to get the code working on http://bdurblg.blogspot.se/2011/06/python-split-any-file-binary-to.html (darn, need to get those indentations right...)
# define the function to split the file into smaller chunks
def splitFile(inputFile,chunkSize):
#read the contents of the file
f = open(inputFile, 'rb')
data = f.read()
f.close()
# get the length of data, ie size of the input file in bytes
bytes = len(data)
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
input { display:none; }
input:checked ~ label { /* color:#fff; */ /* background-color:#7790F7; */
padding: 20px 10px 20px 80px; background-image:url("http://png-4.findicons.com/files/icons/2232/wireframe_mono/48/checkbox_checked.png");
background-repeat:no-repeat; background-size:30px;
background-position: 20px center;
}