This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controllers/search_controller.js | |
import { Controller } from "stimulus" | |
export default class extends Controller { | |
static targets = [ "query", "results" ] | |
search(){ | |
var searchString = this.queryTarget.value | |
fetch(this.data.get("url")+"?query="+searchString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "stimulus" | |
export default class extends Controller { | |
static targets = [ "source", "members" ] | |
search(){ | |
var searchString = this.sourceTarget.value | |
fetch(this.data.get("url")+"?query="+searchString) | |
.then(response => response.text()) | |
.then(html => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-controller="auto-complete" data-auto-complete-url="/customers/search/"> | |
<input type="text" name="search" id="search" | |
placeholder="Customer search [Name or Phone number]" list="members" | |
autocomplete="off" data-action="input->auto-complete#search" | |
data-target="auto-complete.source"> | |
<datalist id="members" data-target="auto-complete.members"> | |
</datalist> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_reverse | |
input = "abc"; | |
result = reverse(input); | |
assert_equal("cba", result); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_pdf_from_image(image_path,image_attributes) | |
if USE_LATEX | |
#new implementation | |
else | |
#old implementation | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PDFGenerator | |
def generate_pdf_from_text(text,font_attributes) | |
#Call the RGhost’s implementation | |
end | |
def generate_pdf_from_image(image_path,image_attributes) | |
#Call the LaTex’s implementation | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PushNotification from 'react-native-push-notification' | |
//App.js | |
async componentDidMount(){ | |
PushNotification.configure({ | |
popInitialNotification: true, | |
requestPermissions: true, | |
// (required) Called when a remote or local notification is opened or received | |
onNotification(notification) { | |
console.log('NOTIFICATION:', notification) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script is for updating the auto_increment field by an offset. The logic applied is | |
max(AUTO_INCREMENT) + current value in the table. | |
*/ | |
SET @db:='id_new'; | |
select @max_id:=max(AUTO_INCREMENT) from information_schema.tables; | |
select concat('update ',table_name,' set ', column_name,' = ',column_name,'+',@max_id,' ; ') from information_schema.columns where table_schema=@db and column_name like '%id' into outfile 'update_ids.sql'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<% @users.each_with_index do |user, index| %>{ | |
"id" : "<%= user.id %>" , | |
"name" : "<%= user.full_name.split.first %>", | |
"profile_image_url" : "<%= user.profile_image_thumbnail.remote_url %>" | |
}<%= ((index + 1) == @users.count)? "" : "," %><% end %>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<% @users.each_with_index do |user, index| %>{ | |
"id" : "<%= user.id %>" , | |
"name" : "<%= user.full_name.split.first %>", | |
"profile_image_url" : "<%= user.profile_image_thumbnail.remote_url %>" | |
}<%= ((index + 1) == @users.size)? "" : "," %><% end %>] |
NewerOlder