Skip to content

Instantly share code, notes, and snippets.

View davidji99's full-sized avatar
🎯
Focusing

DJ davidji99

🎯
Focusing
View GitHub Profile
@davidji99
davidji99 / Convert .mov or .MP4 to .gif.md
Created October 29, 2021 06:44 — forked from SheldonWangRJT/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@davidji99
davidji99 / restful_api.md
Created February 1, 2021 06:03 — forked from oojikoo-gist/restful_api.md
rails: restful api basecontroller

The guide will assume that we are dealing with a pre-existing application that has two models: Album and Artist. An album belongs to an artist and an artist has many albums.

Requirements

This guide is for Rails 4.0.0+ only.

These gems can always be replaced with alternatives, but they will be good for demonstration. Add the following gems to your Gemfile:

Keybase proof

I hereby claim:

  • I am davidji99 on github.
  • I am davidji (https://keybase.io/davidji) on keybase.
  • I have a public key ASDlpknrwY1RSIl0k31GofavDMNcEYNAHhZyrT-BYFto0Ao

To claim this, I am signing this object:

require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = '[email protected]'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@davidji99
davidji99 / getpost.rb
Last active August 29, 2015 14:25
Ruby HTTP/GET and HTTP/POST with auth header, pretty json
module HTTPStuff
def self.post(path, payload)
uri = construct_uri path
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req.body = payload.to_json
req["Authorization"] ='SOMEAUTH'
req["Content-Type"] = "application/json"
print http.request(req)
end
@davidji99
davidji99 / ci.coffee
Last active August 29, 2015 14:22 — forked from larrycai/ci.coffee
# Description:
# Interact with your Jenkins CI server
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_JENKINS_HOST
# HUBOT_JENKINS_AUTH
#
# Ever wanted to force a jenkins build quickly?
# Put this file in your path somewhere, and chmod +x it
curl "http://<jenkins-server-url>/buildByToken/build?job=<job-name>&token=<token>”
# Replace <vars> with your own config
# Goto your project configure page : http://<jenkins-server-url>/job/<job-name>/configure
# And set “Trigger builds remotely” to <token>
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
optimizely.$(".button1").live('click', function(e) {
event.preventDefault(); //prevents the default action from triggering
var destination = optimizely.$(this).attr('href'); //stores the intended redirect URL to a variable
window.optimizely = window.optimizely || []; //activates Optimizely
window.optimizely.push(['trackEvent', 'eventName', {'revenue': 4995}]); //issues tracking call to Optimizely
window.myInterval = setInterval(function() { //sets an interval
if ($('someElement').length) { //checks if element exists. In this case, we are looking for the button element.
//add the variation code either custom written OR rom Optimizely here
clearInterval(window.myInterval); //after element has been found, clear the interval so the page doesn't load continuously
}
}, 50 )//interval timing in milliseconds;