Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jeremie Ges GesJeremie

🏠
Working from home
View GitHub Profile
@mankind
mankind / rails-jsonb-queries
Last active Sep 13, 2021
Ruby on Rails-5 postgresql-9.6 jsonb queries
View rails-jsonb-queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@tomysmile
tomysmile / mac-php-composer-setup.md
Created Jul 11, 2016
Setup PHP Composer using Brew
View mac-php-composer-setup.md
@kylemcdonald
kylemcdonald / CameraImage.cpp
Created Nov 23, 2015
openFrameworks app for sending images to disk for processing, and reading text back from disk. Used for "NeuralTalk and Walk".
View CameraImage.cpp
#include "ofMain.h"
#include "ofxTiming.h"
class ofApp : public ofBaseApp {
public:
ofVideoGrabber grabber;
DelayTimer delay;
ofTrueTypeFont font;
string description;
@mattweldon
mattweldon / up-and-running-with-edeliver-on-do.md
Last active Sep 3, 2021
Getting Elixir / Phoenix running on Digital Ocean with edeliver
View up-and-running-with-edeliver-on-do.md

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
@mtrense
mtrense / Rakefile
Last active Sep 19, 2019
Dynamically create Rake tasks for all Dockerfiles (following the convention "<name>.Dockerfile") in the current directory
View Rakefile
require 'rake/file_list'
IMAGES = Rake::FileList['*.Dockerfile'].collect {|f| f[/.+(?=\.Dockerfile)/] }
namespace :images do
IMAGES.each do |name|
desc "Build image '#{name}'"
task "build_#{name}" do
sh "docker build -f #{name}.Dockerfile -t mtrense/#{name} ."
end
@alexwilson
alexwilson / cloudflare-challenge.js
Last active Sep 3, 2021
This is a project designed to get around sites using Cloudflare's "I'm under attack" mode. Using the PhantomJS headless browser, it queries a site given to it as the second parameter, waits six seconds and returns the cookies required to continue using this site. With this, it is possible to automate scrapers or spiders that would otherwise be t…
View cloudflare-challenge.js
/**
* This is a project designed to get around sites using Cloudflare's "I'm under attack" mode.
* Using the PhantomJS headless browser, it queries a site given to it as the second parameter,
* waits six seconds and returns the cookies required to continue using this site. With this,
* it is possible to automate scrapers or spiders that would otherwise be thwarted by Cloudflare's
* anti-bot protection.
*
* To run this: phantomjs cloudflare-challenge.js http://www.example.org/
*
* Copyright © 2015 by Alex Wilson <antoligy@antoligy.com>
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active Sep 13, 2021
Guide to Developing Addons and Blueprints for Ember CLI
View Converting libraries to Ember CLI addons.md

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@DavertMik
DavertMik / gist:7969053
Created Dec 15, 2013
EmailTestCase for testing emails with MailCatcher in PHPUnit
View gist:7969053
<?php
class EmailTestCase extends PHPUnit_Framework_TestCase {
/**
* @var \Guzzle\Http\Client
*/
private $mailcatcher;
public function setUp()
{
@koenpunt
koenpunt / chosen-bootstrap.css
Last active Jan 25, 2021
Bootstrap 3.0 theme for Chosen
View chosen-bootstrap.css
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;