Skip to content

Instantly share code, notes, and snippets.

Jeroen van Baarsen jvanbaarsen

Block or report user

Report or block jvanbaarsen

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
@jvanbaarsen
jvanbaarsen / app.rb
Created Sep 21, 2016
Auto office joiner
View app.rb
#!/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"
View Feature
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 ==)
View authentication.rb
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
View gist:74dae7a8ec7257e1db60
### 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:
View gist:b8dcd2e7e9320e35dbb4
  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

View omdb_api.rb
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
View Linked list
#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;
View 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)}
You can’t perform that action at this time.