Skip to content

Instantly share code, notes, and snippets.

View jvanbaarsen's full-sized avatar

Jeroen van Baarsen jvanbaarsen

View GitHub Profile
import { Controller } from "@hotwired/stimulus";
import { useTransition } from "stimulus-use";
// Connects to data-controller="profile-menu"
export default class extends Controller {
static targets = ["menu"];
connect() {
this.addTransitionStyling();
useTransition(this, { element: this.menuTarget });
}
@jvanbaarsen
jvanbaarsen / app.rb
Created September 21, 2016 07:25
Auto office joiner
#!/usr/bin/env ruby
# encoding: utf-8
require 'net/http'
require 'socket'
LAST_SEEN_TIME_OUT = 60 * 60 * 2 # 2 hours
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
CHANNEL_ID = "YOUR_CHANNEL_ID"
CHANNEL_NAME="YOUR_CHANNEL_NAME"
@jvanbaarsen
jvanbaarsen / omdb_api.rb
Created August 2, 2013 19:18
Omdb example
require 'omdb'
# Search for all movies with a name like 'Broken City'
movies = Omdb::Api.new.search('Broken city')
puts movies[:status] # => 200
puts movies[:movies].size # => 3
# Get the title of the first movie from the search results
puts movies[:movies].first.title # => Broken City
#include "linkedlist.h"
linked_list create_list() {
linked_list list;
list = malloc (sizeof (struct linked_list));
if (list == NULL) {
//Something weird happend.. We should catch it
exit(-1);
}
list->first = list->last = NULL;
@jvanbaarsen
jvanbaarsen / client_spec.rb
Created May 25, 2013 15:01
client_spec.rb
require_relative '../../spec_helper'
require 'digitalocean/client.rb'
describe Digitalocean::Client do
subject {Digitalocean::Client.new(:client_id => client_id, :api_key => api_key)}
let (:client_id) {CLIENT_ID}
let (:api_key) {API_KEY}
it {should respond_to(:droplets)}
it {should respond_to(:regions)}
Feature: Profile
Scenario: I change my password
✔ Given I sign in as a user # features/steps/shared/authentication.rb:7
✔ Given I visit profile password page # features/steps/shared/paths.rb:102
✔ Then I change my password # features/steps/profile/profile.rb:68
✘ And I should be redirected to sign in page # features/steps/shared/authentication.rb:23
expected: "/users/sign_in"
got: "/profile/password/edit" (using ==)
@jvanbaarsen
jvanbaarsen / authentication.rb
Created February 13, 2015 14:53
Failing spinach step
require Rails.root.join('spec', 'support', 'login_helpers')
module SharedAuthentication
include Spinach::DSL
include LoginHelpers
step 'I sign in as a user' do
login_as :user
end
### Keybase proof
I hereby claim:
* I am jvanbaarsen on github.
* I am jvanbaarsen (https://keybase.io/jvanbaarsen) on keybase.
* I have a public key whose fingerprint is 227E 3387 40DE 8FA7 DF29 C96C DEB7 B358 7B3B A5AF
To claim this, I am signing this object:
@jvanbaarsen
jvanbaarsen / gist:b8dcd2e7e9320e35dbb4
Created September 17, 2014 14:29
Fix for PhpLdapAdmin
  1. Go to /usr/share/phpldapadmin/lib
  2. open the file TemplateRender.php
  3. Search for password_hash and change to password_hash_custom
  4. Save the file, your problem has been solved!

Credits to http://stackoverflow.com/a/21195761