Skip to content

Instantly share code, notes, and snippets.

View clytras's full-sized avatar

Christos Lytras clytras

View GitHub Profile
@clytras
clytras / nginx.conf
Created December 18, 2016 01:37 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@clytras
clytras / gist:8afdbd1f4fd7088da5af9e66ff0e3d75
Created March 14, 2017 08:28 — forked from kbingman/gist:6557074
external include for casper.js login and preview
var require = patchRequire(require);
var loginAndPreview = function(baseUrl, bundleLocation, test){
casper.start('http://preview.mobify.com/', function suite() {
// Add a title comment so that you know what's happening and when
casper.test.comment('Lululemon - 2013 Refresh');
// Log out what we are doing
@clytras
clytras / quotes_json.js
Created March 15, 2017 08:49 — forked from mickaelandrieu/quotes_json.js
Scrap a website with CasperJs, JSON output.
var links = [];
var quotes = [];
var tempUrl = [];
var infos = [];
var maxLinks = 10;
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var newUrl;
var x = require('casper').selectXPath;
@clytras
clytras / watchfiles.md
Created December 1, 2017 21:20 — forked from thiagoh/ watchfiles.md
watchfiles: Watch multiple files and execute bash commands as file changes occur

watchfiles

  • author: Thiago Andrade thiagoh@gmail.com
  • license: GPLv3
  • description:
  • watches the given paths for changes
  • and executes a given command when changes occur
  • usage:
  • watchfiles <paths...>
@clytras
clytras / TransformUtil.js
Created August 23, 2018 15:51 — forked from hpstuff/TransformUtil.js
ReactNativeTransformHelper
import MatrixMath from 'react-native/Libraries/Utilities/MatrixMath';
class TransformUtil {
constructor(matrix) {
this.matrix = matrix || MatrixMath.createIdentityMatrix();
}
perpective(x) {
MatrixMath.reusePerspectiveCommand(this.matrix, x)
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
@clytras
clytras / .gitignore
Created March 27, 2019 07:40 — forked from iffy/.gitignore
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@clytras
clytras / Enhance.js
Created April 4, 2019 14:01 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@clytras
clytras / index.html
Created December 6, 2019 12:36 — forked from StickyCube/index.html
Electron click through transparency example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test App</title>
</head>
<style>
html, body {
height: 100%;
@clytras
clytras / popcount.c
Created March 24, 2020 15:43 — forked from kylelk/popcount.c
sqlite extension to calculate population bit count
/* compile osx
* gcc -bundle -fPIC -O3 -o popcount.dylib popcount.c
* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1